ObservedProperty
struct · ferroui-reactiveui · v0.5.0
struct ObservedProperty
Observes properties with the behaviour of WhenAnyValue, one property at a time
(ObservedProperty).
Upstream offers it to the code that another source generator writes, which cannot rely on the
generator of WhenAnyValue; it takes the property as a lambda and a delegate that reads it.
Here a one-step PropertyPath carries both. then continues a path one
property further, so x => x.A.B is then(create(source, a), b); switch
follows a property that holds an observable, as WhenAnyObservable does.
Members
create
fn create<S: 'static, V: Clone + PartialEq + 'static>(source: &Rc<S>, path: PropertyPath<Rc<S>, V>) -> Rc<dyn IObservable<V>>
The current value of one property, then each value it changes to, skipping repeats
(Create(TSource, Expression<Func<TSource, TValue>>, Func<TSource, TValue>)).
Panics when path has more than one step (ArgumentException).
create2
fn create2<S: 'static, V1: Clone + PartialEq + 'static, V2: Clone + PartialEq + 'static>(source: &Rc<S>, path1: PropertyPath<Rc<S>, V1>, path2: PropertyPath<Rc<S>, V2>) -> Rc<dyn IObservable<(V1, V2)>>
The current values of two properties, then a pair each time either changes
(Create(TSource, ..., ...) of two properties).
create2_select
fn create2_select<S: 'static, V1: Clone + PartialEq + 'static, V2: Clone + PartialEq + 'static, R: 'static>(source: &Rc<S>, path1: PropertyPath<Rc<S>, V1>, path2: PropertyPath<Rc<S>, V2>, selector: impl Fn(V1, V2) -> R + 'static) -> Rc<dyn IObservable<R>>
The values of two properties projected by selector
(Create(TSource, ..., ..., Func<T1, T2, TResult>)).
then
fn then<P: 'static, X: Into<Option<Rc<P>>> + 'static, V: Clone + PartialEq + 'static>(parent: Rc<dyn IObservable<X>>, path: PropertyPath<Rc<P>, V>) -> Rc<dyn IObservable<V>>
The property of whatever object parent holds now, following each replacement of that
object, skipping repeats; nothing is produced while parent holds None
(Then(IObservable<TParent?>, Expression<Func<TParent, TValue>>, Func<TParent, TValue>)).
switch
fn switch<V: 'static>(source: Rc<dyn IObservable<Option<Rc<dyn IObservable<V>>>>>) -> Rc<dyn IObservable<V>>
The values of the latest observable that a property holds; nothing is produced while it
holds None (Switch(IObservable<IObservable<TValue>?>)).
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeBorrow<T>BorrowMut<T>Into<U>From<T>TryInto<U>TryFrom<U>Any
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.