options/token.rs
1use crate::Value;
2use tokens::ChangeToken;
3
4/// Used to fetch [`ChangeToken`](tokens::ChangeToken) used for tracking options changes.
5#[cfg_attr(feature = "async", maybe_impl::traits(Send, Sync))]
6pub trait OptionsChangeTokenSource<T: Value> {
7 /// Creates and returns a [`ChangeToken`](tokens::ChangeToken) which can be
8 /// used to register a change notification callback.
9 fn token(&self) -> Box<dyn ChangeToken>;
10
11 /// Gets the name of the option instance being changed, if any.
12 fn name(&self) -> Option<&str> {
13 None
14 }
15}