Skip to main content

Monitor

Trait Monitor 

Source
pub trait Monitor<T: Value> {
    // Required methods
    fn get_named(&self, name: &str) -> Result<Ref<T>, Error>;
    fn on_change(
        &self,
        changed: Box<dyn Fn(&str, Ref<T>) + Send + Sync>,
    ) -> Subscription<T>;

    // Provided methods
    fn get(&self) -> Result<Ref<T>, Error> { ... }
    fn get_unchecked(&self) -> Ref<T> { ... }
    fn get_named_unchecked(&self, name: &str) -> Ref<T> { ... }
}
Expand description

Defines the behavior for notifications when options instances change.

Required Methods§

Source

fn get_named(&self, name: &str) -> Result<Ref<T>, Error>

Gets the configuration options with the given name.

§Arguments
  • name - The name associated with the options.
Source

fn on_change( &self, changed: Box<dyn Fn(&str, Ref<T>) + Send + Sync>, ) -> Subscription<T>

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

§Arguments
  • changed - The callback function to invoke
§Returns

A change subscription for the specified options. When the subscription is dropped, no further notifications will be propagated.

Provided Methods§

Source

fn get(&self) -> Result<Ref<T>, Error>

Gets the default, unnamed configuration options.

Source

fn get_unchecked(&self) -> Ref<T>

Gets the default, unnamed configuration options.

§Remarks

This function panics if the configuration options could not be successfully retrieved.

Source

fn get_named_unchecked(&self, name: &str) -> Ref<T>

Gets the configuration options with the given name.

§Arguments
  • name - The optional name of the options to retrieve
§Remarks

This function panics if the configuration options could not be successfully retrieved.

Implementors§