Skip to main content

Has

Trait Has 

Source
pub trait Has<T, Index = ()> {
    // Required methods
    fn get(&self) -> &T;
    fn get_mut(&mut self) -> &mut T;
}
Expand description

Trait to extract a dependency T using a specific Index.

The Index type (Here or There) guides the compiler to the correct field.

Required Methods§

Source

fn get(&self) -> &T

Source

fn get_mut(&mut self) -> &mut T

Implementors§

Source§

impl<Head, Tail, T, Index> Has<T, There<Index>> for Dep<Head, Tail>
where Tail: Has<T, Index>,

Recursive case: The item is not in Head, look into Tail.

Source§

impl<T, Tail> Has<T, Here> for Dep<T, Tail>

Base case: The item matches the Head.