Skip to main content

Set

Trait Set 

Source
pub trait Set<T: DataTrait + ?Sized>: Data {
    // Required methods
    fn len(&self) -> usize;
    fn clear(&mut self);
    fn insert_val(&mut self, val: &mut T);
    fn insert_ref(&mut self, val: &T);
    fn dyn_iter<'a>(&'a self) -> Box<dyn Iterator<Item = &'a T> + 'a>;
    fn as_set(&self) -> &DynSet<T>;
    fn as_set_mut(&mut self) -> &mut DynSet<T>;

    // Provided method
    fn is_empty(&self) -> bool { ... }
}
Expand description

A dynamically typed interface to BTreeSet.

Required Methods§

Source

fn len(&self) -> usize

Return the number of elements in self.

Source

fn clear(&mut self)

Clear the set, removing all elements.

Source

fn insert_val(&mut self, val: &mut T)

Add a value to the set without cloning.

Sets val to the default value.

Source

fn insert_ref(&mut self, val: &T)

Add a value to the set, cloning it from val.

Source

fn dyn_iter<'a>(&'a self) -> Box<dyn Iterator<Item = &'a T> + 'a>

Return an iterator over items in self.

Source

fn as_set(&self) -> &DynSet<T>

Cast any trait object that implements this trait to &DynSet.

This method will not be needed once trait downcasting has been stabilized.

Source

fn as_set_mut(&mut self) -> &mut DynSet<T>

Cast any trait object that implements this trait to &mut DynSet.

This method will not be needed once trait downcasting has been stabilized.

Provided Methods§

Source

fn is_empty(&self) -> bool

Check if the set is empty.

Blanket Implementations§

Source§

impl<V, T> Erase<dyn Set<T>> for V
where V: Set<T> + ArchivedDBData, DeserializeImpl<V, dyn Set<T>>: DeserializeDyn<dyn Set<T>>, T: DataTrait + ?Sized,

Source§

fn erase(&self) -> &(dyn Set<T> + 'static)

Convert a reference to self into a reference to Trait.
Source§

fn erase_mut(&mut self) -> &mut (dyn Set<T> + 'static)

Convert a mutable reference to self into a mutable reference to Trait.
Source§

fn erase_box(self: Box<V>) -> Box<dyn Set<T>>

Convert Box<Self> into Box<Trait>.
Source§

fn erase_archived( archived: &<V as Archive>::Archived, ) -> &<dyn Set<T> as ArchiveTrait>::Archived

Convert a reference to an archived representation of Self into a reference to a trait object of type Trait::Archived.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<T, Trait> Set<Trait> for BSet<T>
where Trait: DataTrait + ?Sized, T: DBData + Erase<Trait>, <T as Deserializable>::ArchivedDeser: Ord,