Struct yadf::TreeBag[][src]

#[repr(transparent)]pub struct TreeBag<H: Ord, T>(_);

Counter structure.

Example :

use yadf::TreeBag;

let bag: TreeBag<i32, &str> = vec![
    (3, "hello world"),
    (3, "foobar"),
    (7, "fizz"),
    (7, "buzz"),
    (6, "rust"),
].into_iter().collect();
assert_eq!(bag.as_tree()[&3].len(), 2);
assert_eq!(bag.as_tree()[&6].len(), 1);
assert_eq!(bag.as_tree()[&3][0], "hello world");

Implementations

impl<H: Ord, T> TreeBag<H, T>[src]

pub fn duplicates(&self) -> Replicates<'_, H, T>[src]

Provides a view only on the buckets containing more than one element.

pub fn replicates(&self, factor: Factor) -> Replicates<'_, H, T>[src]

pub fn as_tree(&self) -> &BTreeMap<H, Vec<T>>[src]

Borrows the backing tree map of the bag

Trait Implementations

impl<H: Ord, T> AsRef<BTreeMap<H, Vec<T, Global>>> for TreeBag<H, T>[src]

impl<H: Debug + Ord, T: Debug> Debug for TreeBag<H, T>[src]

impl<H: Ord, T> From<BTreeMap<H, Vec<T, Global>>> for TreeBag<H, T>[src]

impl<H: Ord, T> FromIterator<(H, T)> for TreeBag<H, T>[src]

impl<H, T> Serialize for TreeBag<H, T> where
    H: Ord + Serialize,
    T: Serialize
[src]

Auto Trait Implementations

impl<H, T> RefUnwindSafe for TreeBag<H, T> where
    H: RefUnwindSafe,
    T: RefUnwindSafe
[src]

impl<H, T> Send for TreeBag<H, T> where
    H: Send,
    T: Send
[src]

impl<H, T> Sync for TreeBag<H, T> where
    H: Sync,
    T: Sync
[src]

impl<H, T> Unpin for TreeBag<H, T>[src]

impl<H, T> UnwindSafe for TreeBag<H, T> where
    H: RefUnwindSafe,
    T: RefUnwindSafe
[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pointable for T

type Init = T

The type for initializers.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,