Expand description
§Async version for ZeroMQ bindings
Async-zmq is high-level bindings for zmq
in asynchronous manner which is compatible to every async runtime.
No need for configuring or tuning features. Just plug in and see how it works!
§Usage
Users could simply initialize any socket type with async_zmq::*
in mind, and then call
bind()
or connect
depends on your scenario. For example, if someone wants a publish socket,
then he could initialize the socket like this:
let zmq = async_zmq::publish("tcp://127.0.0.1:5555")?.bind();
If there’s context need to be shared between different socket, we can set it during building the socket:
let context = Context::new();
let xpub = async_zmq::xpublish("inproc://example")?.with_context(&context).bind();
let sub = subscribe("inproc://example")?.with_context(&context).connect()?;
Since the use case of this crate is mostly for sending/recieving multipart message. So it provides Multipart
which is a type alias for Vec<Message>
when recieving message on type implemented with Stream
, and MultipartIter
which is a generic struct make any queue can turn into iterator and then send via type implemented with Sink
.
To learn more about each socket type usage. See modules below.
Re-exports§
pub use crate::dealer::dealer;
pub use crate::dealer::Dealer;
pub use crate::pair::pair;
pub use crate::pair::Pair;
pub use crate::publish::publish;
pub use crate::publish::Publish;
pub use crate::pull::pull;
pub use crate::pull::Pull;
pub use crate::push::push;
pub use crate::push::Push;
pub use crate::reply::reply;
pub use crate::reply::Reply;
pub use crate::request::request;
pub use crate::request::Request;
pub use crate::router::router;
pub use crate::router::Router;
pub use crate::stream::stream;
pub use crate::stream::ZmqStream;
pub use crate::subscribe::subscribe;
pub use crate::subscribe::Subscribe;
pub use crate::xpublish::xpublish;
pub use crate::xpublish::XPublish;
pub use crate::xsubscribe::xsubscribe;
pub use crate::xsubscribe::XSubscribe;
pub use zmq;
pub use crate::errors::*;
Modules§
- dealer
- DEALER socket module of Request-reply pattern in ZMQ
- errors
- Errors
- pair
- PAIR socket module of Exclusive pair pattern in ZMQ
- publish
- PUB socket module of Pub-Sub pattern in ZMQ
- pull
- PULL socket module of Pipeline pattern in ZMQ
- push
- PUSH socket module of Pipeline pattern in ZMQ
- reply
- REP socket module of Request-reply pattern in ZMQ
- request
- REQ socket module of Request-reply pattern in ZMQ
- router
- ROUTER socket module of Request-reply pattern in ZMQ
- stream
- STREAM socket module of Pub-Sub pattern in ZMQ
- subscribe
- SUB socket module of Pub-Sub pattern in ZMQ
- xpublish
- XPUB socket module of Pub-Sub pattern in ZMQ
- xsubscribe
- XSUB socket module of Pub-Sub pattern in ZMQ
Structs§
- Context
- Handle for a 0MQ context, used to create sockets.
- Message
- Holds a 0MQ message.
- Multipart
Iter - Multipart Iterator for Sending under
Sink
. - Socket
Builder - ZMQ socket builder. It lets user to either bind or connect the socket of their choice.
Enums§
- Error
- An error returned by a 0MQ API function.
Traits§
- AsRaw
Socket - Trait to get the raw zmq socket.
- Sink
- A
Sink
is a value into which other values can be sent, asynchronously. - SinkExt
- An extension trait for
Sink
s that provides a variety of convenient combinator functions. - Stream
- A stream of values produced asynchronously.
- Stream
Ext - An extension trait for
Stream
s that provides a variety of convenient combinator functions.