1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
//! # TMQ - Rust ZeroMQ bindings for Tokio
//!
//! This crate bridges Tokio and ZeroMQ to allow for ZeroMQ in the async world.
//!
//! ## Currently Implemented Sockets
//!
//! * Request/Reply
//! * Publish/Subscribe
//! * Dealer/Router
//! * Push/Pull
//! ## Usage
//!
//! Usage is made to be simple, but opinionated. See the [`examples/`](https://github.com/cetra3/tmq/tree/master/examples) Directory for some examples.
//!
//! ### Publish Example
//!
//! To publish messages to all connected subscribers, you can use the `publish` function:
//!
//! ```rust,no_run
//! use tmq::{publish, Context, Result};
//!
//! use futures::SinkExt;
//! use log::info;
//! use std::env;
//! use std::time::Duration;
//! use tokio::time::sleep;
//!
//! #[tokio::main]
//! async fn main() -> Result<()> {
//!
//! let mut socket = publish(&Context::new()).bind("tcp://127.0.0.1:7899")?;
//!
//! let mut i = 0;
//!
//! loop {
//! i += 1;
//!
//! socket
//! .send(vec!["topic", &format!("Broadcast #{}", i)])
//! .await?;
//!
//! sleep(Duration::from_secs(1)).await;
//! }
//! }
//! ```
/// Shortcut for [`Result<T, tmq::TmqError>`].
pub type Result<T> = Result;
pub use ;
/// Internal re-exports
pub use TmqError;
pub use Multipart;
pub use ;
pub use SocketBuilder;
pub use *;
/// Crate re-exports
pub use *;