pub struct FieldCore<T> {
pub signal: Signal<T>,
pub interceptors: Arc<Mutex<Vec<(u64, Arc<dyn Fn(Change<T>) -> Option<Change<T>> + Send + Sync + 'static>)>>>,
pub next_interceptor_id: Arc<AtomicUsize>,
pub intercept_depth: InterceptDepth,
pub rules: Arc<Mutex<Vec<DeclaredRule<T>>>>,
}Fields§
§signal: Signal<T>§interceptors: Arc<Mutex<Vec<(u64, Arc<dyn Fn(Change<T>) -> Option<Change<T>> + Send + Sync + 'static>)>>>§next_interceptor_id: Arc<AtomicUsize>§intercept_depth: InterceptDepth§rules: Arc<Mutex<Vec<DeclaredRule<T>>>>Implementations§
Source§impl<T: Clone + 'static> FieldCore<T>
impl<T: Clone + 'static> FieldCore<T>
pub fn new_with_signal(initial: Signal<T>) -> Self
pub fn new(initial: T) -> Self
Sourcepub fn rule<F>(&self, rule: F)
pub fn rule<F>(&self, rule: F)
Adds a rule every write has to pass, after the interceptors and for as long as the field lives: there is no handle to take it off.
Sourcepub fn ruled(&self, value: &mut T) -> Result<(), String>
pub fn ruled(&self, value: &mut T) -> Result<(), String>
Puts value through the declared rules, in the order they were added.
pub fn get(&self) -> T
pub fn subscribe<F>(&self, callback: F) -> SignalSubscription
pub fn subscribe_with_source<F>(&self, callback: F) -> SignalSubscription
pub fn intercept<F>(&self, path: StorePath, callback: F) -> InterceptDisposer
pub fn run_interceptors( &self, path: StorePath, value: T, source: Option<Uuid>, ) -> Result<Change<T>, Refusal>
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for FieldCore<T>
impl<T> RefUnwindSafe for FieldCore<T>
impl<T> Send for FieldCore<T>
impl<T> Sync for FieldCore<T>
impl<T> Unpin for FieldCore<T>
impl<T> UnsafeUnpin for FieldCore<T>
impl<T> UnwindSafe for FieldCore<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