Skip to main content

Config

Struct Config 

Source
pub struct Config { /* private fields */ }

Implementations§

Source§

impl Config

Source

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
Hide additional 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}
Source

pub fn client_id(self, client_id: String) -> Self

Source

pub fn hostname(self, hostname: String) -> Self

Source

pub fn user_agent(self, user_agent: String) -> Self

Source

pub fn snappy(self, snappy: bool) -> Self

Trait Implementations§

Source§

impl Clone for Config

Source§

fn clone(&self) -> Config

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Config

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Config

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for Config

Source§

fn eq(&self, other: &Config) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for Config

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Config

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.