pub trait OptionsMonitorCache<T> {
    // Required methods
    fn get_or_add(
        &self,
        name: Option<&str>,
        create_options: &dyn Fn(Option<&str>) -> T
    ) -> Ref<T>;
    fn try_add(&self, name: Option<&str>, options: T) -> bool;
    fn try_remove(&self, name: Option<&str>) -> bool;
    fn clear(&self);
}
Expand description

Defines the behavior of an Options monitor cache.

Required Methods§

source

fn get_or_add( &self, name: Option<&str>, create_options: &dyn Fn(Option<&str>) -> T ) -> Ref<T>

Gets or adds options with the specified name.

Arguments
  • name - The optional name of the options
  • create_options - The function used to create options when added
source

fn try_add(&self, name: Option<&str>, options: T) -> bool

Attempts to add options with the specified name.

Arguments
  • name - The optional name of the options
  • options - The options to add
source

fn try_remove(&self, name: Option<&str>) -> bool

Attempts to remove options with the specified name.

Arguments
  • name - The optional name of the options
source

fn clear(&self)

Clears all options from the cache.

Implementors§