Trait r3::bag::Bag

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

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

A heterogeneous collection to store property values.

Required Methods§

source

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

Borrow a T if it’s included in self.

source

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

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

Provided Methods§

source

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

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<Head, Tail> Bag for (Head, Tail)where Head: 'static + Copy, Tail: Bag,

source§

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

source§

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

source§

impl Bag for ()

source§

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

source§

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

Implementors§

source§

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