pub fn of_option<Item>(o: Option<Item>) -> OptionObservable<Item>
Expand description

Creates an observable that potentially emits a single value from Option.

Emits the value if is there, and completes immediately after. When the given option has not value, completes immediately. Never emits an error.

Arguments

  • o - An optional used to take a value to emits from.

Examples

use rxrust::prelude::*;

observable::of_option(Some(1234))
  .subscribe(|v| {println!("{},", v)});