rx_core_operator_composite

Crates.iorx_core_operator_composite
lib.rsrx_core_operator_composite
version0.2.0
created_at2026-01-19 13:06:00.695676+00
updated_at2026-01-24 15:04:22.203549+00
descriptioncomposite operator for rx_core
homepagehttps://github.com/AlexAegis/rx_bevy
repositoryhttps://github.com/AlexAegis/rx_bevy
max_upload_size
id2054590
size12,028
Sandor (AlexAegis)

documentation

https://github.com/AlexAegis/rx_bevy

README

operator_composite

crates.io ci codecov license

Build reusable operator chains without needing a source observable.

See Also

  • IdentityOperator - A no-op operator, used mainly as the entry point of a CompositeOperator.

Example

cargo run -p rx_core --example operator_composite_operators_example
use rx_core::prelude::*;

/// Composite operators offer an easy way to create complex operators, but they
/// do increase type complexity, good for prototyping and smaller things, but
/// you should prefer implementing an actual operator
fn main() {
  // Though not necessary, the IdentityOperator provides an easy way to define
  // input types for our composite operator.
  let op = IdentityOperator::<i32, Never>::default()
    .map(|next: i32| next + 1)
    .map(|next: i32| next * 100);

  let _s = just(1).pipe(op).subscribe(PrintObserver::new("hello"));

  // Or though the type extensions you can chain built in operators just like on observables
  let op_2 = IdentityOperator::<i32, Never>::default()
    .map(|i| i * 2)
    .filter(|i, _| i % 2 == 0);

  let _s2 = just(1).pipe(op_2).subscribe(PrintObserver::new("bello"));
}
hello - next: 200
hello - completed
hello - unsubscribed
bello - next: 2
bello - completed
bello - unsubscribed
Commit count: 652

cargo fmt