[][src]Struct resources::Entry

pub struct Entry<'a, T: Resource> { /* fields omitted */ }

A view into a specific Resource's entry in a Resources container, which may either be vacant or occupied.

This is returned by the entry method on Resources.

Methods

impl<'a, T: Resource> Entry<'a, T>[src]

pub fn or_insert(self, default: T) -> RefMut<'a, T>[src]

Ensures a resource is in the entry by inserting the given value if empty, and returns a mutable reference to the contained resource.

pub fn or_insert_with(self, default: impl FnOnce() -> T) -> RefMut<'a, T>[src]

Ensures a resource is in the entry by inserting the result of given function if empty, and returns a mutable reference to the contained resource.

pub fn and_modify(self, f: impl FnOnce(&mut T)) -> Self[src]

Provides in-place mutable access to an occupied entry before any potential inserts.

impl<'a, T: Resource + Default> Entry<'a, T>[src]

pub fn or_default(self) -> RefMut<'a, T>[src]

Ensures a resource is in the entry by inserting it's default value if empty, and returns a mutable reference to the contained resource.

Auto Trait Implementations

impl<'a, T> !RefUnwindSafe for Entry<'a, T>

impl<'a, T> Send for Entry<'a, T>

impl<'a, T> Sync for Entry<'a, T>

impl<'a, T> Unpin for Entry<'a, T> where
    T: Unpin

impl<'a, T> !UnwindSafe for Entry<'a, T>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Downcast for T where
    T: Any
[src]

impl<T> DowncastSync for T where
    T: Send + Sync + Any
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = !

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.