Struct resman::Entry [−][src]
pub struct Entry<'a, R> { /* fields omitted */ }
Implementations
An entry to a resource container.
This is similar to the Entry API found in the standard library.
Examples
use rt_map::RtMap; #[derive(Debug)] struct Res(i32); let mut rt_map = RtMap::<u32, Res>::default(); let value = rt_map.entry(0).or_insert(Res(4)); println!("{:?}", value.0 * 2);
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, R> !RefUnwindSafe for Entry<'a, R>
impl<'a, R> !UnwindSafe for Entry<'a, R>
Blanket Implementations
Mutably borrows from an owned value. Read more
Convert Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
. Read more
Convert Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
. Read more
Convert &Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s. Read more
Convert &mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s. Read more