[−][src]Struct rpds::set::red_black_tree_set::RedBlackTreeSet
A persistent set with structural sharing. This implementation uses a red-black tree.
Complexity
Let n be the number of elements in the set.
Temporal complexity
Operation | Average | Worst case |
---|---|---|
new() | Θ(1) | Θ(1) |
insert() | Θ(log(n)) | Θ(log(n)) |
remove() | Θ(log(n)) | Θ(log(n)) |
get() | Θ(log(n)) | Θ(log(n)) |
contains() | Θ(log(n)) | Θ(log(n)) |
size() | Θ(1) | Θ(1) |
clone() | Θ(1) | Θ(1) |
iterator creation | Θ(log(n)) | Θ(log(n)) |
iterator step | Θ(1) | Θ(log(n)) |
iterator full | Θ(n) | Θ(n) |
Implementation details
This is a thin wrapper around a RedBlackTreeMap
.
Methods
impl<T> RedBlackTreeSet<T> where
T: Ord,
[src]
T: Ord,
#[must_use]
pub fn new() -> RedBlackTreeSet<T>
[src]
#[must_use]
pub fn new() -> RedBlackTreeSet<T>#[must_use]
pub fn insert(&self, v: T) -> RedBlackTreeSet<T>
[src]
#[must_use]
pub fn insert(&self, v: T) -> RedBlackTreeSet<T>pub fn insert_mut(&mut self, v: T)
[src]
#[must_use]
pub fn remove<V: ?Sized>(&self, v: &V) -> RedBlackTreeSet<T> where
T: Borrow<V>,
V: Ord,
[src]
#[must_use]
pub fn remove<V: ?Sized>(&self, v: &V) -> RedBlackTreeSet<T> whereT: Borrow<V>,
V: Ord,
pub fn remove_mut<V: ?Sized>(&mut self, v: &V) -> bool where
T: Borrow<V>,
V: Ord,
[src]
T: Borrow<V>,
V: Ord,
#[must_use]
pub fn contains<V: ?Sized>(&self, v: &V) -> bool where
T: Borrow<V>,
V: Ord,
[src]
#[must_use]
pub fn contains<V: ?Sized>(&self, v: &V) -> bool whereT: Borrow<V>,
V: Ord,
#[must_use]
pub fn first(&self) -> Option<&T>
[src]
#[must_use]
pub fn first(&self) -> Option<&T>#[must_use]
pub fn last(&self) -> Option<&T>
[src]
#[must_use]
pub fn last(&self) -> Option<&T>#[must_use]
pub fn is_disjoint(&self, other: &RedBlackTreeSet<T>) -> bool
[src]
#[must_use]
pub fn is_disjoint(&self, other: &RedBlackTreeSet<T>) -> bool#[must_use]
pub fn is_subset(&self, other: &RedBlackTreeSet<T>) -> bool
[src]
#[must_use]
pub fn is_subset(&self, other: &RedBlackTreeSet<T>) -> bool#[must_use]
pub fn is_superset(&self, other: &RedBlackTreeSet<T>) -> bool
[src]
#[must_use]
pub fn is_superset(&self, other: &RedBlackTreeSet<T>) -> bool#[must_use]
pub fn size(&self) -> usize
[src]
#[must_use]
pub fn size(&self) -> usize#[must_use]
pub fn is_empty(&self) -> bool
[src]
#[must_use]
pub fn is_empty(&self) -> bool#[must_use]
pub fn iter(&self) -> Iter<T>
[src]
#[must_use]
pub fn iter(&self) -> Iter<T>#[must_use]
pub fn range<Q: ?Sized, RB>(&self, range: RB) -> RangeIter<T, RB, Q> where
T: Borrow<Q>,
Q: Ord,
RB: RangeBounds<Q>,
[src]
#[must_use]
pub fn range<Q: ?Sized, RB>(&self, range: RB) -> RangeIter<T, RB, Q> whereT: Borrow<Q>,
Q: Ord,
RB: RangeBounds<Q>,
Trait Implementations
impl<'a, T> IntoIterator for &'a RedBlackTreeSet<T> where
T: Ord,
[src]
T: Ord,
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) -> Iter<'a, T>
[src]
impl<T> Eq for RedBlackTreeSet<T> where
T: Ord,
[src]
T: Ord,
impl<T> Clone for RedBlackTreeSet<T> where
T: Ord,
[src]
T: Ord,
fn clone(&self) -> RedBlackTreeSet<T>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<T> PartialEq<RedBlackTreeSet<T>> for RedBlackTreeSet<T> where
T: Ord,
[src]
T: Ord,
fn eq(&self, other: &RedBlackTreeSet<T>) -> bool
[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ne(&self, other: &Rhs) -> boolThis method tests for !=
.
impl<T> Default for RedBlackTreeSet<T> where
T: Ord,
[src]
T: Ord,
fn default() -> RedBlackTreeSet<T>
[src]
impl<T> FromIterator<T> for RedBlackTreeSet<T> where
T: Ord,
[src]
T: Ord,
fn from_iter<I: IntoIterator<Item = T>>(into_iter: I) -> RedBlackTreeSet<T>
[src]
impl<T: Debug> Debug for RedBlackTreeSet<T> where
T: Ord,
[src]
T: Ord,
impl<T> Display for RedBlackTreeSet<T> where
T: Ord + Display,
[src]
T: Ord + Display,
impl<T> Serialize for RedBlackTreeSet<T> where
T: Ord + Serialize,
[src]
T: Ord + Serialize,
impl<'de, T> Deserialize<'de> for RedBlackTreeSet<T> where
T: Ord + Deserialize<'de>,
[src]
T: Ord + Deserialize<'de>,
fn deserialize<D: Deserializer<'de>>(
deserializer: D
) -> Result<RedBlackTreeSet<T>, D::Error>
[src]
deserializer: D
) -> Result<RedBlackTreeSet<T>, D::Error>
Auto Trait Implementations
impl<T> Send for RedBlackTreeSet<T> where
T: Send + Sync,
T: Send + Sync,
impl<T> Sync for RedBlackTreeSet<T> where
T: Send + Sync,
T: Send + Sync,
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
🔬 This is a nightly-only experimental API. (
try_from
)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> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
🔬 This is a nightly-only experimental API. (
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,