Trait r3_core::bag::Bag

source ·
pub trait Bag: Sealed + Copy {
    // Required methods
    fn get<T: 'static>(&self) -> Option<&T>;
    fn get_mut<T: 'static>(&mut self) -> Option<&mut T>;

    // Provided method
    fn insert<T: 'static>(self, head: T) -> List<T, Self> { ... }
}
Expand description

A heterogeneous collection to store property values.

Required Methods§

source

fn get<T: 'static>(&self) -> Option<&T>

Borrow a T if it’s included in self.

source

fn get_mut<T: 'static>(&mut self) -> Option<&mut T>

Mutably borrow a T if it’s included in self.

Provided Methods§

source

fn insert<T: 'static>(self, head: T) -> List<T, Self>

Insert an item and return a new impl Bag.

For const fn-ness, this method can’t have a provided implementation.

Implementations on Foreign Types§

source§

impl<Left: Bag, Right: Bag> Bag for Either<Left, Right>

source§

const fn get<T: 'static>(&self) -> Option<&T>

source§

const fn get_mut<T: 'static>(&mut self) -> Option<&mut T>

Implementors§

source§

impl Bag for Empty

source§

impl<Head: 'static + Copy, Tail: Bag> Bag for List<Head, Tail>