pub trait SinkStreamSocket: IntoInnerSocket {
    fn sink_stream(
        self,
        buffer_size: usize
    ) -> <<Self as IntoInnerSocket>::Socket as InnerSocket<Self>>::SinkStream; }
Expand description

This trait is provided for sockets that implement both Sync and Stream

Required Methods

Retrieve a structure that implements both Sync and Stream.

It takes a buffer_size argument, which will determine how many Multiparts can be submitted into the send queue before the sink applies backpressure.

Example, using a Rep wrapper type
extern crate futures;
extern crate tokio_zmq;
extern crate zmq;

use std::sync::Arc;

use futures::{Future, Stream};
use tokio_zmq::{prelude::*, Rep};

fn main() {
    let ctx = Arc::new(zmq::Context::new());
    let fut = Rep::builder(ctx)
        .bind("tcp://*:5571")
        .build()
        .and_then(|rep| {
            let (sink, stream) = rep.sink_stream(25).split();

            stream.forward(sink)
        });

    // tokio::run(fut.map(|_| ()).or_else(|e| {
    //     println!("Error: {}", e);
    //     Ok(())
    // }));
}

Implementors