Crates.io | gabelung |
lib.rs | gabelung |
version | 0.2.4 |
source | src |
created_at | 2020-05-26 15:13:03.802084 |
updated_at | 2020-11-06 10:08:10.720912 |
description | Branch an asynchronous stream of cloneable items into two. |
homepage | |
repository | https://github.com/NeoLegends/gabelung |
max_upload_size | |
id | 246243 |
size | 18,171 |
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).
It does not depend on executor features and thus is runtime agnostic. It is
verified to work on both async_std
and tokio
.
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));
MIT