pub fn new<S: Stream>(stream: S) -> (Branch<S, S::Item>, Branch<S, S::Item>) {
    let inner = Arc::new(Mutex::new(Inner {
        left: State::Live(None, None),
        right: State::Live(None, None),
        stream,
    }));

    let left = Branch {
        direction: Direction::Left,
        inner: inner.clone(),
    };
    let right = Branch {
        direction: Direction::Right,
        inner: inner,
    };

    (left, right)
}
/// Branch the given stream into two.
///
/// This creates two handles which 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.
///
/// # Example
///
/// ```rust
/// # #[tokio::main]
/// # async fn main() {
/// 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));
/// # }
/// ```
Branch the given stream into two.
This creates two handles which 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.
Branch the given stream into two . This creates two handles which 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 .
pub fn new<S: Stream>(stream: S) -> (Branch<S, S::Item>, Branch<S, S::Item>) {
    let inner = Arc::new(Mutex::new(Inner {
        left: State::Live(None, None),
        right: State::Live(None, None),
        stream,
    }));
    let left = Branch {
        direction: Direction::Left,
        inner: inner.clone(),
    };
    let right = Branch {
        direction: Direction::Right,
        inner: inner,
    };
    (left, right)
}
pub fn new < S : Stream > ( stream : S ) -> ( Branch < S , S :: Item > , Branch < S , S :: Item > ) { let inner = Arc :: new ( Mutex :: new ( Inner { left : State :: Live ( None , None ) , right : State :: Live ( None , None ) , stream , } ) ) ; let left = Branch { direction : Direction :: Left , inner : inner . clone ( ) , } ; let right = Branch { direction : Direction :: Right , inner : inner , } ; ( left , right ) }
Branch the given stream into two.
Branch the given stream into two .
stream
S
stream
S
example
None
#[tokio::main]
None
async fn main() {
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)).
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 )) .
}
None