pub trait OptionsMonitorCache<T: Value> {
// 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§
Sourcefn get_or_add(
&self,
name: Option<&str>,
create_options: &dyn Fn(Option<&str>) -> T,
) -> Ref<T>
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 optionscreate_options
- The function used to create options when added
Sourcefn try_add(&self, name: Option<&str>, options: T) -> bool
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 optionsoptions
- The options to add