pub fn create_stream_with_buffer<T, S>(
    s: S,
    size: usize,
) -> (
    impl Stream<Item = T> + Send + 'static,
    impl Future<Output = ()> + Send + 'static,
)
where
    S: Stream<Item = T> + Send + 'static,
    T: Send + 'static,
{
    let (tx, rx) = mpsc::channel::<T>(size);
    let driver = s
        .then(future::ok::<T, mpsc::SendError>)
        .forward(tx)
        .map_err(|e| warn!("stream with buffer send error"; "error" => %e))
        .map(|_| ());
    (rx, driver)
}
/// Create a stream proxy with buffer representing the remote stream. The returned task
/// will receive messages from the remote stream as much as possible.
Create a stream proxy with buffer representing the remote stream. The returned task
will receive messages from the remote stream as much as possible.
Create a stream proxy with buffer representing the remote stream . The returned task will receive messages from the remote stream as much as possible .
pub fn create_stream_with_buffer<T, S>(
    s: S,
    size: usize,
) -> (
    impl Stream<Item = T> + Send + 'static,
    impl Future<Output = ()> + Send + 'static,
)
where
    S: Stream<Item = T> + Send + 'static,
    T: Send + 'static,
{
    let (tx, rx) = mpsc::channel::<T>(size);
    let driver = s
        .then(future::ok::<T, mpsc::SendError>)
        .forward(tx)
        .map_err(|e| warn!("stream with buffer send error"; "error" => %e))
        .map(|_| ());
    (rx, driver)
}
pub fn create_stream_with_buffer < T , S > ( s : S , size : usize , ) -> ( impl Stream < Item = T > + Send + ' static , impl Future < Output = ( ) > + Send + ' static , ) where S : Stream < Item = T > + Send + ' static , T : Send + ' static , { let ( tx , rx ) = mpsc :: channel :: < T > ( size ) ; let driver = s . then ( future :: ok :: < T , mpsc :: SendError > ) . forward ( tx ) . map_err ( | e | warn ! ( " " " " e ) ) . map ( | _ | ( ) ) ; ( rx , driver ) }
Create a stream proxy with buffer representing the remote stream.
Create a stream proxy with buffer representing the remote stream .
s
S
size
usize