pub struct AvlTreeSet<T> { /* private fields */ }
Expand description

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

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

Returns true if the set contains no elements.

Returns the number of elements in the set.

Clears the set, deallocating all memory.

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

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

The value may be any borrowed form of the set’s value type, but the ordering on the borrowed form must match the ordering on the value type.

Returns true if the set contains a value.

The value may be any borrowed form of the set’s value type, but the ordering on the borrowed form must match the ordering on the value type.

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

The value may be any borrowed form of the set’s value type, but the ordering on the borrowed form must match the ordering on the value type.

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

The value may be any borrowed form of the set’s value type, but the ordering on the borrowed form must match the ordering on the value type.

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

The value may be any borrowed form of the set’s value type, but the ordering on the borrowed form must match the ordering on the value type.

Panics

Panics if range start > end. Panics if range start == end and both bounds are Excluded.

Inserts a value into the set.

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

Splits the collection into two at the given key. Returns everything after the given key, including the key.

Gets an iterator over the values of the union set, i.e., all values in self or other, without duplicates, in ascending order.

Gets an iterator over the values of the intersection set, i.e., all values that are botih in self and other, in ascending order.

Gets an iterator over the values of the difference between two sets, i.e., all values that are in self but not in other, in ascending order.

Gets an iterator over the values of the symmectric difference of two sets, i.e., all values in self or other, but not in both, in ascending order.

Returns true if self has no elements in common with other. This is equivalent to checking for an empty intersection.

Returns true if the set is a subset of another, i.e., other contains at least all the values in self.

Returns true if the set is a superset of another, i.e., self contains at least all the values in other.

Trait Implementations

Returns the intersection of self and rhs as a new set.

The resulting type after applying the & operator.

Returns the union of self and rhs as a new set.

The resulting type after applying the | operator.

Returns the symmetric difference of self and rhs as a new set.

The resulting type after applying the ^ operator.

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Creates an empty set.

Extends a collection with the contents of an iterator. Read more

🔬 This is a nightly-only experimental API. (extend_one)

Extends a collection with exactly one element.

🔬 This is a nightly-only experimental API. (extend_one)

Reserves capacity in a collection for the given number of additional elements. Read more

Extends a collection with the contents of an iterator. Read more

🔬 This is a nightly-only experimental API. (extend_one)

Extends a collection with exactly one element.

🔬 This is a nightly-only experimental API. (extend_one)

Reserves capacity in a collection for the given number of additional elements. Read more

Creates a value from an iterator. Read more

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

Creates an iterator from a value. Read more

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

Creates an iterator from a value. Read more

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

Restrict a value to a certain interval. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Returns the difference of self and rhs as a new set.

The resulting type after applying the - operator.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.