pub trait SetStorage<T>: Sized {
    type Iter<'this>: Iterator<Item = T>
       where Self: 'this;
    type IntoIter: Iterator<Item = T>;

    // Required methods
    fn empty() -> Self;
    fn len(&self) -> usize;
    fn is_empty(&self) -> bool;
    fn insert(&mut self, value: T) -> bool;
    fn contains(&self, value: T) -> bool;
    fn remove(&mut self, value: T) -> bool;
    fn retain<F>(&mut self, f: F)
       where F: FnMut(T) -> bool;
    fn clear(&mut self);
    fn iter(&self) -> Self::Iter<'_>;
    fn into_iter(self) -> Self::IntoIter;
}
Expand description

The trait defining how storage works for Set.

Type Arguments

  • T is the key being stored.

Required Associated Types§

source

type Iter<'this>: Iterator<Item = T> where Self: 'this

Immutable iterator over storage.

source

type IntoIter: Iterator<Item = T>

Owning iterator over the storage.

Required Methods§

source

fn empty() -> Self

Construct empty storage.

source

fn len(&self) -> usize

Get the length of storage.

source

fn is_empty(&self) -> bool

Check if storage is empty.

source

fn insert(&mut self, value: T) -> bool

This is the storage abstraction for Set::insert.

source

fn contains(&self, value: T) -> bool

This is the storage abstraction for Set::contains.

source

fn remove(&mut self, value: T) -> bool

This is the storage abstraction for Set::remove.

source

fn retain<F>(&mut self, f: F)where F: FnMut(T) -> bool,

This is the storage abstraction for Set::retain.

source

fn clear(&mut self)

This is the storage abstraction for Set::clear.

source

fn iter(&self) -> Self::Iter<'_>

This is the storage abstraction for Set::iter.

source

fn into_iter(self) -> Self::IntoIter

This is the storage abstraction for Set::into_iter.

Implementors§

source§

impl SetStorage<bool> for BooleanSetStorage

§

type Iter<'this> = Iter

§

type IntoIter = Iter

source§

impl<T> SetStorage<Option<T>> for OptionSetStorage<T>where T: Key,

§

type Iter<'this> where T: 'this = Chain<Map<<<T as Key>::SetStorage as SetStorage<T>>::Iter<'this>, fn(_: T) -> Option<T>>, IntoIter<Option<T>>>

§

type IntoIter = Chain<Map<<<T as Key>::SetStorage as SetStorage<T>>::IntoIter, fn(_: T) -> Option<T>>, IntoIter<Option<T>>>

source§

impl<T> SetStorage<T> for HashbrownSetStorage<T>where T: Copy + Eq + Hash,

§

type Iter<'this> where T: 'this = Copied<Iter<'this, T>>

§

type IntoIter = IntoIter<T, Global>

source§

impl<T> SetStorage<T> for SingletonSetStoragewhere T: Default,

§

type Iter<'this> = IntoIter<T>

§

type IntoIter = IntoIter<T>