fluxion-rx
Part of Fluxion - A reactive stream processing library for Rust
The main entry point for Fluxion, providing a unified API that re-exports all stream operators and utilities.
What is fluxion-rx?
fluxion-rx is the convenience crate that brings together all Fluxion components:
- Stream operators from
fluxion-stream - Core traits and types from
fluxion-core - Async execution from
fluxion-exec - Stream merging from
fluxion-ordered-merge
It serves as a container crate with no implementation code of its own - all functionality is delegated to specialized crates. This design keeps the codebase modular while providing a single, convenient import point.
Quick Start
Add this to your Cargo.toml:
[]
= "0.8.0"
= { = "1.48.0", = ["full"] }
Converting Channels to Streams: UnboundedReceiverExt
The primary feature unique to fluxion-rx is the UnboundedReceiverExt trait, which bridges tokio's channels with Fluxion's stream operators.
Why UnboundedReceiverExt?
Fluxion follows a design philosophy that separates:
- Production code: Immutable, composable stream transformations
- Test code: Imperative channel operations for setup
This solves a fundamental conflict:
- Stream extensions consume
self(ownership) - Channel sends need
&mut self(mutation)
Basic Usage
use *;
use mpsc;
use Sequenced;
async
Or use into_fluxion_stream to transform the channel type:
use *;
use mpsc;
use Sequenced;
async
```### Type Transformation with into_fluxion_stream
When combining multiple channel types, use `into_fluxion_stream` to map them to a common type:
```rust
use *;
use mpsc;
// Implement HasTimestamp for your type if it has intrinsic timestamps,
// or use Sequenced<T> wrapper for automatic timestamping
async
Key Benefits:
- Type erasure: Boxed streams hide implementation details
- Heterogeneous sources: Combine channels of different types
- Clean separation: Channels for setup, streams for processing
Stream Operators
For detailed information about stream operators, see the fluxion-stream README.
Quick reference:
Combining Streams:
combine_latest- Emit when any stream updateswith_latest_from- Sample secondary streamsordered_merge- Merge preserving temporal ordermerge_with- Stateful event stream merging
Filtering & Gating:
filter_ordered- Filter based on predicateemit_when- Gate emissionstake_latest_when- Sample on triggertake_while_with- Emit while condition holds
Transformation:
map_ordered- Transform valuescombine_with_previous- Pair consecutive values
For comprehensive operator documentation, see:
Async Execution
For async processing patterns like subscribe and subscribe_latest, see the fluxion-exec README.
Complete Example
use FluxionStream;
use StreamExt;
use mpsc;
async
Documentation
- Main Project README - Overview and getting started
- fluxion-stream README - All stream operators
- fluxion-exec README - Async execution patterns
- Error Handling Guide - Error propagation patterns
- Operator Summary - Quick reference
Architecture
The Fluxion project is organized into focused crates:
fluxion-rx ← You are here (convenience re-exports)
├── fluxion-core (traits, types, error handling)
├── fluxion-stream (all stream operators)
├── fluxion-exec (async execution utilities)
├── fluxion-ordered-merge (ordered stream merging)
└── fluxion-test-utils (testing utilities)
License
Apache-2.0