pub trait OptionsMonitor<T> {
    // Required methods
    fn current_value(&self) -> &T;
    fn get(&self, name: Option<&str>) -> &T;
    fn on_change(&self, listener: Weak<dyn Fn(Option<&str>, &T)>);
}
Expand description

Defines the behavior for notifications when option instances change.

Required Methods§

source

fn current_value(&self) -> &T

Returns the current instance with the default options name.

source

fn get(&self, name: Option<&str>) -> &T

Returns a configured instance with the given name.

Arguments
  • name - the name associated with the options.
source

fn on_change(&self, listener: Weak<dyn Fn(Option<&str>, &T)>)

Registers a callback function to be invoked when the configured instance with the given name changes.

Arguments
  • listener - a weak reference to callback function to invoke

Implementors§