pub struct DefaultOptionsMonitor<T: Value> { /* private fields */ }
Expand description
Represents the default implementation for notifications when option instances change.
Implementations§
Source§impl<T: Value + 'static> DefaultOptionsMonitor<T>
impl<T: Value + 'static> DefaultOptionsMonitor<T>
Sourcepub fn new(
cache: Ref<dyn OptionsMonitorCache<T>>,
sources: Vec<Ref<dyn OptionsChangeTokenSource<T>>>,
factory: Ref<dyn OptionsFactory<T>>,
) -> Self
pub fn new( cache: Ref<dyn OptionsMonitorCache<T>>, sources: Vec<Ref<dyn OptionsChangeTokenSource<T>>>, factory: Ref<dyn OptionsFactory<T>>, ) -> Self
Initializes a new default options monitor.
§Arguments
cache
- The cache used for monitored optionssources
- The source tokens used to track option changesfactory
- The factory used to create new options
Trait Implementations§
Source§impl<T: Value> OptionsMonitor<T> for DefaultOptionsMonitor<T>
impl<T: Value> OptionsMonitor<T> for DefaultOptionsMonitor<T>
Source§fn get(&self, name: Option<&str>) -> Ref<T>
fn get(&self, name: Option<&str>) -> Ref<T>
Returns a configured instance with the given name. Read more
Source§fn on_change(
&self,
listener: Box<dyn Fn(Option<&str>, Ref<T>) + Send + Sync>,
) -> Subscription<T>
fn on_change( &self, listener: Box<dyn Fn(Option<&str>, Ref<T>) + Send + Sync>, ) -> Subscription<T>
Registers a callback function to be invoked when the configured instance with the given name changes. Read more
Source§fn current_value(&self) -> Ref<T>
fn current_value(&self) -> Ref<T>
Returns the current instance with the default options name.
impl<T: Send + Sync> Send for DefaultOptionsMonitor<T>
impl<T: Send + Sync> Sync for DefaultOptionsMonitor<T>
Auto Trait Implementations§
impl<T> Freeze for DefaultOptionsMonitor<T>
impl<T> !RefUnwindSafe for DefaultOptionsMonitor<T>
impl<T> Unpin for DefaultOptionsMonitor<T>
impl<T> !UnwindSafe for DefaultOptionsMonitor<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