| Crates.io | rx_core_operator_composite |
| lib.rs | rx_core_operator_composite |
| version | 0.2.0 |
| created_at | 2026-01-19 13:06:00.695676+00 |
| updated_at | 2026-01-24 15:04:22.203549+00 |
| description | composite operator for rx_core |
| homepage | https://github.com/AlexAegis/rx_bevy |
| repository | https://github.com/AlexAegis/rx_bevy |
| max_upload_size | |
| id | 2054590 |
| size | 12,028 |
Build reusable operator chains without needing a source observable.
CompositeOperator.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