Struct shred::Entry [−][src]
pub struct Entry<'a, T: 'a> { /* fields omitted */ }
Expand description
An entry to a resource of the World
struct.
This is similar to the Entry API found in the standard library.
Examples
use shred::World; #[derive(Debug)] struct Res(i32); let mut world = World::empty(); let value = world.entry().or_insert(Res(4)); println!("{:?}", value.0 * 2);
Implementations
Returns this entry’s value, inserts and returns v
otherwise.
Please note that you should use or_insert_with
in case the creation of
the value is expensive.
Returns this entry’s value, inserts and returns the return value of f
otherwise.
Auto Trait Implementations
impl<'a, T> !RefUnwindSafe for Entry<'a, T>
impl<'a, T> !UnwindSafe for Entry<'a, T>