ObserverExt
trait · ferroui-reactive · v0.5.0
trait ObserverExt<T>
The extension methods of Observer on an observer (Observer.Extensions.cs).
Members
to_notifieras_observercheckedsynchronizesynchronize_prevent_reentrancysynchronize_with_gatesynchronize_with_locknotify_onnotify_on_schedulenotify_on_contextto_progressto_progress_on
to_notifier
fn to_notifier(self: &Self) -> Box<dyn Fn(Notification<T>) -> ()>
The observer as a function of notifications (ToNotifier).
as_observer
fn as_observer(self: &Self) -> Rc<dyn IObserver<T>>
An observer that hides the identity of this one (AsObserver).
checked
fn checked(self: &Self) -> Rc<dyn IObserver<T>>
An observer that checks the grammar of the notifications it receives (Checked): it panics,
where upstream throws InvalidOperationException, on a notification after a terminal one
and on a notification while another is being handled.
synchronize
fn synchronize(self: &Self) -> Rc<dyn IObserver<T>>
An observer whose notifications reach this one under a lock of its own
(Synchronize(IObserver<T>), a SynchronizedObserver<T>): it ignores everything after a
terminal notification. On one thread the notifications are serialized already, and the lock
of upstream (a monitor) is re-entrant: a notification that re-enters the observer from
inside another reaches this one at once.
synchronize_prevent_reentrancy
fn synchronize_prevent_reentrancy(self: &Self, prevent_reentrancy: bool) -> Rc<dyn IObserver<T>>
An observer whose notifications reach this one one at a time
(Synchronize(IObserver<T>, bool preventReentrancy)): with prevent_reentrancy, through an
AsyncLock of its own, so that a notification that re-enters the observer from inside
another is queued and reaches this one when that one has returned (AsyncLockObserver<T>);
without, as synchronize.
synchronize_with_gate
fn synchronize_with_gate(self: &Self, gate: Rc<dyn std::any::Any>) -> Rc<dyn IObserver<T>>
An observer whose notifications reach this one under the lock gate
(Synchronize(IObserver<T>, object gate)), which observers may share; as
synchronize, the lock is re-entrant and has nothing to serialize on
one thread. The observer keeps the gate.
synchronize_with_lock
fn synchronize_with_lock(self: &Self, async_lock: Rc<AsyncLock>) -> Rc<dyn IObserver<T>>
An observer whose notifications reach this one through async_lock
(Synchronize(IObserver<T>, AsyncLock), an AsyncLockObserver<T>), which observers may
share: a notification that arrives while an action of the lock runs (a re-entrant one) is
queued and reaches this one after it.
notify_on
fn notify_on(self: &Self, scheduler: Rc<dyn crate::concurrency::IScheduler>) -> Rc<dyn IObserver<T>>
An observer that delivers the notifications to this one on scheduler, in order
(NotifyOn(IScheduler)).
notify_on_schedule
fn notify_on_schedule(self: &Self, schedule: std::sync::Arc<dyn ferroui_system::task::Schedule>) -> Rc<dyn IObserver<T>>
An observer that delivers the notifications to this one through schedule, in order
(NotifyOn(SynchronizationContext): the observer of NotifyOn(IScheduler) on a
SynchronizationContextScheduler of
the schedule, which posts with
schedule_local: the observer is notified
on the thread of the schedule).
notify_on_context
fn notify_on_context(self: &Self, context: std::sync::Arc<dyn ferroui_system::threading::SynchronizationContext>) -> Rc<dyn IObserver<T>>
An observer that delivers the notifications to this one through context, in order
(NotifyOn(SynchronizationContext): the observer of NotifyOn(IScheduler) on a
SynchronizationContextScheduler of
the context, which posts with post_local: the observer is notified on the thread of the
context).
Deprecated since 0.5.0. use
notify_on_schedulewith aferroui_system::task::Schedule
to_progress
fn to_progress(self: &Self) -> Rc<dyn IProgress<T>>
A progress object whose reports are the values of this observer (ToProgress(IObserver<T>)).
to_progress_on
fn to_progress_on(self: &Self, scheduler: Rc<dyn crate::concurrency::IScheduler>) -> Rc<dyn IProgress<T>>
A progress object whose reports reach this observer as values on scheduler, in order
(ToProgress(IObserver<T>, IScheduler), through the observer of ObserveOn).
Trait implementations
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.