Add stubs for other queues
This commit is contained in:
parent
6e91aef421
commit
6878652583
7 changed files with 38 additions and 5 deletions
|
@ -1,5 +1,6 @@
|
|||
/// Data structures for the "pure" min-queues, supporting duplicates but no arbitrary updates
|
||||
pub mod binary_heap;
|
||||
mod binary_heap;
|
||||
pub use binary_heap::BinaryHeap;
|
||||
|
||||
/// A data structure usable for backing a "pure" queue
|
||||
pub trait PureBacking<T: Ord + Send + Sync>: Send + Sync {
|
||||
|
|
|
@ -2,11 +2,13 @@ pub mod backing;
|
|||
pub mod queue;
|
||||
|
||||
use pyo3::prelude::*;
|
||||
use queue::paired::PairedQueue;
|
||||
use queue::{IndexedQueue, PairedQueue, PureQueue};
|
||||
|
||||
/// Bindings for the Rust queue implementations
|
||||
#[pymodule]
|
||||
fn pyority_queue(m: &Bound<'_, PyModule>) -> PyResult<()> {
|
||||
m.add_class::<PureQueue>()?;
|
||||
m.add_class::<PairedQueue>()?;
|
||||
m.add_class::<IndexedQueue>()?;
|
||||
Ok(())
|
||||
}
|
||||
|
|
12
src/queue/indexed.rs
Normal file
12
src/queue/indexed.rs
Normal file
|
@ -0,0 +1,12 @@
|
|||
use pyo3::prelude::*;
|
||||
|
||||
#[pyclass]
|
||||
pub struct IndexedQueue {}
|
||||
|
||||
#[pymethods]
|
||||
impl IndexedQueue {
|
||||
#[new]
|
||||
fn new() -> Self {
|
||||
Self {}
|
||||
}
|
||||
}
|
|
@ -1 +1,7 @@
|
|||
pub mod paired;
|
||||
mod indexed;
|
||||
mod paired;
|
||||
mod pure;
|
||||
|
||||
pub use indexed::IndexedQueue;
|
||||
pub use paired::PairedQueue;
|
||||
pub use pure::PureQueue;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// A "pure" priority queue that supports duplicates, but not arbitrary deletions or weight updates
|
||||
use crate::backing::{
|
||||
item::Item,
|
||||
pure::{binary_heap::BinaryHeap, PureBacking},
|
||||
pure::{BinaryHeap, PureBacking},
|
||||
};
|
||||
use pyo3::prelude::*;
|
||||
|
||||
|
|
12
src/queue/pure.rs
Normal file
12
src/queue/pure.rs
Normal file
|
@ -0,0 +1,12 @@
|
|||
use pyo3::prelude::*;
|
||||
|
||||
#[pyclass]
|
||||
pub struct PureQueue {}
|
||||
|
||||
#[pymethods]
|
||||
impl PureQueue {
|
||||
#[new]
|
||||
fn new() -> Self {
|
||||
Self {}
|
||||
}
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
#[cfg(test)]
|
||||
mod tests {
|
||||
use pyority_queue::backing::pure::{binary_heap::BinaryHeap, PureBacking};
|
||||
use pyority_queue::backing::pure::{BinaryHeap, PureBacking};
|
||||
|
||||
#[test]
|
||||
fn test_pure_binary_heap_manual_creation() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue