GithubHelp home page GithubHelp logo

tempbottle / priority-queue Goto Github PK

View Code? Open in Web Editor NEW

This project forked from garro95/priority-queue

0.0 1.0 0.0 59 KB

A priority queue for Rust with efficient change function.

License: GNU Lesser General Public License v3.0

Rust 100.00%

priority-queue's Introduction

PriorityQueue

https://travis-ci.org/garro95/priority-queue.svg?branch=master

This crate implements a Priority Queue with a function to change the priority of an object. Priority and items are stored in an OrderMap and the queue is implemented as a Heap of indexes.

Please read the API documentation here

Usage

To use this crate, simply add the following string to your Cargo.toml:

priority-queue = "0.4"

Notice that a change in the last digit (patch number) means that the interface is backward and forward compatible and contains other type of fixes, like bug fixes or documentation updates. A change in the middle digit (minor) means that the interface is backward compatible but includes something new, so that the previous version may be not forward compatible. A change in the first, left digit may means a breacking change in the interface, that will not be backward compatible anymore. Version 1.0.0 may be an exception to this and may means just that the API is stable and is considered production ready.

Then use the data structure inside your Rust source code as in the following Example.

Remember that, if you need serde support, you should compile using --features serde.

Example

extern crate priority_queue;

use priority_queue::PriorityQueue;

fn main {
    let mut pq = PriorityQueue::new();

    assert!(pq.is_empty());
    pq.push("Apples", 5);
    pq.push("Bananas", 8);
    pq.push("Strawberries", 23);

    assert_eq!(pq.peek(), &("Strawberries", 23));

    for (item, _) in pq.into_sorted_iter() {
        println!("{}", item);
    }
}

Contributing

Feel free to contribute to this project with pull requests and/or issues. All contribution should be under a license compatible with the GNU LGPL.

Changes

  • 0.5.1 Add some documentation for iter_mut()
  • 0.5.0 Fix #7 implementing the iter_mut features
  • 0.4.5 Fix #6 for change_priority and change_priority_by
  • 0.4.4 Fix #6
  • 0.4.3 Fix #4 changing the way PriorityQueue serializes. Note that old serialized PriorityQueues may be incompatible with the new version. The API should not be changed instead.
  • 0.4.2 Improved performance using some unsafe code in the implementation.
  • 0.4.1 Support for serde when compiled with --features serde. serde marked as optional and serde-test as dev-dipendency. Now compiling the crate won't download and compile also serde-test, neither serde if not needed.
  • 0.4.0 Support for serde when compiled with cfg(serde)
  • 0.3.1 Fix #3
  • 0.3.0 Implement PartialEq and Eq traits

priority-queue's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.