https://github.com/neolegends/gabelung
Branch an asynchronous stream of cloneable items into two.
https://github.com/neolegends/gabelung
branch fork futures rust stream
Last synced: 3 months ago
JSON representation
Branch an asynchronous stream of cloneable items into two.
- Host: GitHub
- URL: https://github.com/neolegends/gabelung
- Owner: NeoLegends
- License: mit
- Created: 2020-05-26T14:10:48.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2020-11-06T10:06:13.000Z (over 5 years ago)
- Last Synced: 2025-02-15T02:09:24.845Z (over 1 year ago)
- Topics: branch, fork, futures, rust, stream
- Language: Rust
- Size: 22.5 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://crates.io/crates/gabelung)
# gabelung
Branch an asynchronous stream into two, pushing all items to both halves.
The resulting branches can be polled independently from each other and will
receive all items from the underlying stream (which must be `Clone`).
As long as both halves are alive, one half will never outpace the other by more
than a fixed number of items.
The goal of this library is to obsolete itself by integration with `futures-rs` (pending [issue](https://github.com/rust-lang/futures-rs/issues/2166)).
It does not depend on executor features and thus is runtime agnostic. It is
verified to work on both `async_std` and `tokio`.
## Example
```rust
use futures::{stream, prelude::*};
let (mut left, mut right) = gabelung::new(stream::repeat(1u8));
assert_eq!(left.next().await, Some(1u8));
assert_eq!(right.next().await, Some(1u8));
```
## License
MIT