[][src]Struct avl::set::AvlTreeSet

pub struct AvlTreeSet<T> { /* fields omitted */ }

An ordered set implemented with an AVL tree.

use avl::AvlTreeSet;
let mut set = AvlTreeSet::new();
set.insert(0);
set.insert(1);
set.insert(2);
assert_eq!(set.get(&1), Some(&1));
set.remove(&1);
assert!(set.get(&1).is_none());

Implementations

impl<T: Ord> AvlTreeSet<T>[src]

pub fn new() -> Self[src]

Creates an empty set. No memory is allocated until the first item is inserted.

pub fn get(&self, value: &T) -> Option<&T>[src]

Returns a reference to the value in the set that is equal to the given value.

pub fn contains(&self, value: &T) -> bool[src]

Returns true if the set contains a value.

pub fn insert(&mut self, value: T) -> bool[src]

Inserts a value into the set.

pub fn remove(&mut self, value: &T) -> bool[src]

Removes a value from the set. Returns whether the value was previously in the set.

pub fn take(&mut self, value: &T) -> Option<T>[src]

Removes a value from the set. Returns the value if it was previously in the set.

pub fn append(&mut self, other: &mut Self)[src]

Moves all values from other into self, leaving other empty.

pub fn range<R: RangeBounds<T>>(&self, range: R) -> Range<'_, T>

Notable traits for Range<'a, T>

impl<'a, T> Iterator for Range<'a, T> type Item = &'a T;
[src]

Gets an iterator over a sub-range of values in the set in sorted order.

impl<T> AvlTreeSet<T>[src]

pub fn is_empty(&self) -> bool[src]

Returns true if the set contains no elements.

pub fn len(&self) -> usize[src]

Returns the number of elements in the set.

pub fn clear(&mut self)[src]

Clears the set, deallocating all memory.

pub fn iter(&self) -> Iter<'_, T>

Notable traits for Iter<'a, T>

impl<'a, T> Iterator for Iter<'a, T> type Item = &'a T;
[src]

Gets an iterator over the values of the map in sorted order.

Trait Implementations

impl<T: Clone> Clone for AvlTreeSet<T>[src]

impl<T: Debug> Debug for AvlTreeSet<T>[src]

impl<T: Ord> Default for AvlTreeSet<T>[src]

fn default() -> Self[src]

Creates an empty set.

impl<T: Eq> Eq for AvlTreeSet<T>[src]

impl<'a, T> Extend<&'a T> for AvlTreeSet<T> where
    T: Ord + Copy,
    T: 'a, 
[src]

impl<T> Extend<T> for AvlTreeSet<T> where
    T: Ord + Copy
[src]

impl<T: Ord> FromIterator<T> for AvlTreeSet<T>[src]

impl<'a, T> IntoIterator for &'a AvlTreeSet<T>[src]

type Item = &'a T

The type of the elements being iterated over.

type IntoIter = Iter<'a, T>

Which kind of iterator are we turning this into?

impl<T> IntoIterator for AvlTreeSet<T>[src]

type Item = T

The type of the elements being iterated over.

type IntoIter = IntoIter<T>

Which kind of iterator are we turning this into?

impl<T: Ord> Ord for AvlTreeSet<T>[src]

impl<T: PartialEq> PartialEq<AvlTreeSet<T>> for AvlTreeSet<T>[src]

impl<T: PartialOrd> PartialOrd<AvlTreeSet<T>> for AvlTreeSet<T>[src]

impl<T> StructuralEq for AvlTreeSet<T>[src]

impl<T> StructuralPartialEq for AvlTreeSet<T>[src]

Auto Trait Implementations

impl<T> RefUnwindSafe for AvlTreeSet<T> where
    T: RefUnwindSafe

impl<T> !Send for AvlTreeSet<T>

impl<T> !Sync for AvlTreeSet<T>

impl<T> Unpin for AvlTreeSet<T>

impl<T> UnwindSafe for AvlTreeSet<T> where
    T: RefUnwindSafe

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<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

type IntoIter = I

Which kind of iterator are we turning this into?

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.