pub struct Cache<T>(/* private fields */);Expand description
Represents a monitored cache of configured options.
Implementations§
Source§impl<T: Value> Cache<T>
impl<T: Value> Cache<T>
Sourcepub fn get_or_add(
&self,
name: &str,
create: &dyn Fn(&str) -> Result<T, Error>,
) -> Result<Ref<T>, Error>
pub fn get_or_add( &self, name: &str, create: &dyn Fn(&str) -> Result<T, Error>, ) -> Result<Ref<T>, Error>
Gets or adds options with the specified name.
§Arguments
name- The optional name of the optionscreate- The function used to create options when added
Trait Implementations§
Auto Trait Implementations§
impl<T> !Freeze for Cache<T>
impl<T> RefUnwindSafe for Cache<T>
impl<T> !Send for Cache<T>
impl<T> !Sync for Cache<T>
impl<T> Unpin for Cache<T>
impl<T> UnsafeUnpin for Cache<T>
impl<T> UnwindSafe for Cache<T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more