Struct SockConfig

Source
pub struct SockConfig<'a, T>
where T: IntoInnerSocket,
{ pub ctx: Arc<Context>, pub bind: Vec<&'a str>, pub connect: Vec<&'a str>, pub identity: Option<&'a [u8]>, pub customize: Box<dyn Fn(&Socket)>, /* private fields */ }
Expand description

The final builder step for some socket types

This contains all the information required to contstruct a valid socket, except in the case of SUB, which needs an additional filter parameter.

Fields§

§ctx: Arc<Context>§bind: Vec<&'a str>§connect: Vec<&'a str>§identity: Option<&'a [u8]>§customize: Box<dyn Fn(&Socket)>

Implementations§

Source§

impl<'a, T> SockConfig<'a, T>

Source

pub fn bind(self, addr: &'a str) -> Self

Bind the SockConfig to an address, returning a SockConfig

This allows for a single socket to be bound to multiple addresses.

Source

pub fn connect(self, addr: &'a str) -> Self

Connect the SockConfig to an address, returning a SockConfig

This allows for a single socket to be connected to multiple addresses.

Source

pub fn customize<F>(self, f: F) -> Self
where F: Fn(&Socket) + 'static,

Provide a function for configuring the underlying ZeroMQ socket

Note: Only the last call to customize will apply to a given socket.

Documentation can be found here

Source

pub fn do_build(self) -> Result<Socket, Error>

Source§

impl<'a, T> SockConfig<'a, T>
where T: IntoInnerSocket + Pair,

Source

pub fn pair(self, addr: &'a str, bind: bool) -> PairConfig<'a>

Bind or Connect the socket to an address

This method indicates that the resulting socket will be a PAIR socket.

Source§

impl<'a, T> SockConfig<'a, T>
where T: IntoInnerSocket + Sub,

Source

pub fn filter(self, pattern: &'a [u8]) -> SubConfig<'a>

Continue the building process into a SubConfig, for the SUB socket type which requires setting a subscription filter.

Auto Trait Implementations§

§

impl<'a, T> Freeze for SockConfig<'a, T>

§

impl<'a, T> !RefUnwindSafe for SockConfig<'a, T>

§

impl<'a, T> !Send for SockConfig<'a, T>

§

impl<'a, T> !Sync for SockConfig<'a, T>

§

impl<'a, T> Unpin for SockConfig<'a, T>
where T: Unpin,

§

impl<'a, T> !UnwindSafe for SockConfig<'a, T>

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> 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, 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.