Simplify IndexedQueue API
Although similar to PureQueue, it doesn't make sense to use the exact same signatures. Also don't make API users use Pair<D, P>.
This commit is contained in:
parent
16c1a4d390
commit
63515e2314
3 changed files with 40 additions and 56 deletions
|
@ -1,6 +1,6 @@
|
|||
use std::{collections::HashMap, hash::Hash};
|
||||
|
||||
use crate::backing::{containers::Pair, indexed::IndexedBacking, pure::PureBacking};
|
||||
use crate::backing::{containers::Pair, indexed::IndexedBacking};
|
||||
|
||||
pub struct IndexedBinaryHeap<D: Hash + Clone + Send + Sync, P: PartialOrd + Clone + Send + Sync> {
|
||||
data: Vec<Pair<D, P>>,
|
||||
|
@ -16,26 +16,10 @@ impl<D: Hash + Clone + Send + Sync, P: PartialOrd + Clone + Send + Sync> Indexed
|
|||
}
|
||||
}
|
||||
|
||||
impl<D: Hash + Clone + Send + Sync, P: PartialOrd + Clone + Send + Sync> FromIterator<Pair<D, P>>
|
||||
impl<D: Hash + Clone + Send + Sync, P: PartialOrd + Clone + Send + Sync> FromIterator<(D, P)>
|
||||
for IndexedBinaryHeap<D, P>
|
||||
{
|
||||
fn from_iter<T: IntoIterator<Item = Pair<D, P>>>(iter: T) -> Self {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
impl<D: Hash + Clone + Send + Sync, P: PartialOrd + Clone + Send + Sync> PureBacking<Pair<D, P>>
|
||||
for IndexedBinaryHeap<D, P>
|
||||
{
|
||||
fn add(&mut self, item: Pair<D, P>) {
|
||||
todo!()
|
||||
}
|
||||
|
||||
fn pop(&mut self) -> Option<Pair<D, P>> {
|
||||
todo!()
|
||||
}
|
||||
|
||||
fn len(&self) -> usize {
|
||||
fn from_iter<T: IntoIterator<Item = (D, P)>>(iter: T) -> Self {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
@ -43,15 +27,23 @@ impl<D: Hash + Clone + Send + Sync, P: PartialOrd + Clone + Send + Sync> PureBac
|
|||
impl<D: Hash + Clone + Send + Sync, P: PartialOrd + Clone + Send + Sync> IndexedBacking<D, P>
|
||||
for IndexedBinaryHeap<D, P>
|
||||
{
|
||||
fn update(&mut self, data: D, priority: P) -> bool {
|
||||
todo!()
|
||||
}
|
||||
|
||||
fn remove(&mut self, data: D) -> bool {
|
||||
fn len(&self) -> usize {
|
||||
todo!()
|
||||
}
|
||||
|
||||
fn contains(&self, data: &D) -> bool {
|
||||
todo!()
|
||||
}
|
||||
|
||||
fn set(&mut self, data: D, priority: P) {
|
||||
todo!()
|
||||
}
|
||||
|
||||
fn remove(&mut self, data: D) -> Option<P> {
|
||||
todo!()
|
||||
}
|
||||
|
||||
fn pop(&mut self) -> Option<D> {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue