pub struct Config { /* private fields */ }Implementations§
Source§impl Config
impl Config
Sourcepub fn default() -> Config
pub fn default() -> Config
Examples found in repository?
examples/pub.rs (line 17)
11fn main() {
12 let mut core = Core::new().unwrap();
13 let handle = core.handle();
14
15 let addr = "127.0.0.1:4150".parse().unwrap();
16
17 let res = Producer::connect(&addr, &handle, Config::default())
18 .and_then(|conn| {
19 conn.publish("some_topic".into(), "some_message".into())
20 .and_then(move |response| {
21 println!("Response: {:?}", response);
22 Ok(())
23 })
24 });
25 core.run(res).unwrap();
26}More examples
examples/mpub.rs (line 21)
11fn main() {
12 let mut core = Core::new().unwrap();
13 let handle = core.handle();
14
15 let addr = "127.0.0.1:4150".parse().unwrap();
16
17 let mut messages: Vec<String> = Vec::new();
18 messages.push("First message".into());
19 messages.push("Second message".into());
20
21 let res = Producer::connect(&addr, &handle, Config::default())
22 .and_then(|conn| {
23 conn.mpublish("some_topic".into(), messages)
24 .and_then(move |response| {
25 println!("Response: {:?}", response);
26 Ok(())
27 })
28 });
29 core.run(res).unwrap();
30}examples/sub.rs (line 16)
10fn main() {
11 let mut core = Core::new().unwrap();
12 let handle = core.handle();
13 let addr = "127.0.0.1:4150".parse().unwrap();
14
15 core.run(
16 Consumer::connect(&addr, &handle, Config::default())
17 .and_then(|conn| {
18 conn.subscribe("some_topic".into(), "some_channel".into())
19 .and_then(move |response| {
20 let ret = response.for_each(move |message| {
21 if message.message_id == "_heartbeat_" {
22 conn.nop();
23 } else {
24 println!("Response {:?} {:?}", message.message_id, message.message_body);
25 conn.fin(message.message_id); // Inform NSQ (Message consumed)
26 }
27 Ok(())
28 });
29 ret
30 })
31 })
32 ).unwrap();
33}pub fn client_id(self, client_id: String) -> Self
pub fn hostname(self, hostname: String) -> Self
pub fn user_agent(self, user_agent: String) -> Self
pub fn snappy(self, snappy: bool) -> Self
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Config
impl<'de> Deserialize<'de> for Config
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for Config
Auto Trait Implementations§
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnsafeUnpin for Config
impl UnwindSafe for Config
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more