observer_fn
Define observers from callbacks: FnObserver (static dispatch) and DynFnObserver (dynamic dispatch).
See Also
- PrintObserver - Log observed signals to stdout.
- NoopObserver - Ignore all signals (panics on errors in debug).
Example
cargo run -p rx_core --example observer_fn_example
let _subscription = just("world").subscribe(FnObserver::new(
|next| println!("hello: {next}"),
|_error| println!("error"),
|| {},
));
Output:
hello: world