[−][src]Struct avl::set::AvlTreeSet
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>ⓘ
[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>ⓘ
[src]
Gets an iterator over the values of the map in sorted order.
Trait Implementations
impl<T: Clone> Clone for AvlTreeSet<T>
[src]
fn clone(&self) -> AvlTreeSet<T>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<T: Debug> Debug for AvlTreeSet<T>
[src]
impl<T: Ord> Default for AvlTreeSet<T>
[src]
impl<T: Eq> Eq for AvlTreeSet<T>
[src]
impl<'a, T> Extend<&'a T> for AvlTreeSet<T> where
T: Ord + Copy,
T: 'a,
[src]
T: Ord + Copy,
T: 'a,
fn extend<I>(&mut self, iter: I) where
I: IntoIterator<Item = &'a T>,
[src]
I: IntoIterator<Item = &'a T>,
fn extend_one(&mut self, item: A)
[src]
fn extend_reserve(&mut self, additional: usize)
[src]
impl<T> Extend<T> for AvlTreeSet<T> where
T: Ord + Copy,
[src]
T: Ord + Copy,
fn extend<I>(&mut self, iter: I) where
I: IntoIterator<Item = T>,
[src]
I: IntoIterator<Item = T>,
fn extend_one(&mut self, item: A)
[src]
fn extend_reserve(&mut self, additional: usize)
[src]
impl<T: Ord> FromIterator<T> for AvlTreeSet<T>
[src]
fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self
[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?
fn into_iter(self) -> Self::IntoIter
[src]
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?
fn into_iter(self) -> Self::IntoIter
[src]
impl<T: Ord> Ord for AvlTreeSet<T>
[src]
fn cmp(&self, other: &AvlTreeSet<T>) -> Ordering
[src]
#[must_use]fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn clamp(self, min: Self, max: Self) -> Self
[src]
impl<T: PartialEq> PartialEq<AvlTreeSet<T>> for AvlTreeSet<T>
[src]
fn eq(&self, other: &AvlTreeSet<T>) -> bool
[src]
fn ne(&self, other: &AvlTreeSet<T>) -> bool
[src]
impl<T: PartialOrd> PartialOrd<AvlTreeSet<T>> for AvlTreeSet<T>
[src]
fn partial_cmp(&self, other: &AvlTreeSet<T>) -> Option<Ordering>
[src]
fn lt(&self, other: &AvlTreeSet<T>) -> bool
[src]
fn le(&self, other: &AvlTreeSet<T>) -> bool
[src]
fn gt(&self, other: &AvlTreeSet<T>) -> bool
[src]
fn ge(&self, other: &AvlTreeSet<T>) -> bool
[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,
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,
T: RefUnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<I> IntoIterator for I where
I: Iterator,
[src]
I: Iterator,
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?
fn into_iter(self) -> I
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,