Struct tokio_zmq::socket::config::SockConfig [−][src]
pub struct SockConfig<'a> { pub ctx: Arc<Context>, pub bind: Vec<&'a str>, pub connect: Vec<&'a str>, pub identity: Option<&'a [u8]>, }
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]>
Methods
impl<'a> SockConfig<'a>
[src]
impl<'a> SockConfig<'a>
pub fn bind(self, addr: &'a str) -> Self
[src]
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.
pub fn connect(self, addr: &'a str) -> Self
[src]
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.
pub fn build(self, kind: SocketType) -> Result<Socket, Error>
[src]
pub fn build(self, kind: SocketType) -> Result<Socket, Error>
Finalize the SockConfig
into a Socket
if the creation is successful, or into an Error
if something went wrong.
Since we can't dynamically create different wrapper types (Rep, Req, Pub, etc.), we just create the inner Socket, and expect this function to be called in a few contexts
- The caller is a wrapper type.
- The caller knows what they're doing.
For convenience, TryFrom<SockConfig>
is implemented for all valid wrapper types.
pub fn filter(self, pattern: &'a [u8]) -> SubConfig<'a>
[src]
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.
Trait Implementations
impl<'a> TryFrom<SockConfig<'a>> for Dealer
[src]
impl<'a> TryFrom<SockConfig<'a>> for Dealer
type Error = Error
try_from
)The type returned in the event of a conversion error.
fn try_from(conf: SockConfig<'a>) -> Result<Self, Self::Error>
[src]
fn try_from(conf: SockConfig<'a>) -> Result<Self, Self::Error>
try_from
)Performs the conversion.
impl<'a> TryFrom<SockConfig<'a>> for Pub
[src]
impl<'a> TryFrom<SockConfig<'a>> for Pub
type Error = Error
try_from
)The type returned in the event of a conversion error.
fn try_from(conf: SockConfig<'a>) -> Result<Self, Self::Error>
[src]
fn try_from(conf: SockConfig<'a>) -> Result<Self, Self::Error>
try_from
)Performs the conversion.
impl<'a> TryFrom<SockConfig<'a>> for Pull
[src]
impl<'a> TryFrom<SockConfig<'a>> for Pull
type Error = Error
try_from
)The type returned in the event of a conversion error.
fn try_from(conf: SockConfig<'a>) -> Result<Self, Self::Error>
[src]
fn try_from(conf: SockConfig<'a>) -> Result<Self, Self::Error>
try_from
)Performs the conversion.
impl<'a> TryFrom<SockConfig<'a>> for Push
[src]
impl<'a> TryFrom<SockConfig<'a>> for Push
type Error = Error
try_from
)The type returned in the event of a conversion error.
fn try_from(conf: SockConfig<'a>) -> Result<Self, Self::Error>
[src]
fn try_from(conf: SockConfig<'a>) -> Result<Self, Self::Error>
try_from
)Performs the conversion.
impl<'a> TryFrom<SockConfig<'a>> for Rep
[src]
impl<'a> TryFrom<SockConfig<'a>> for Rep
type Error = Error
try_from
)The type returned in the event of a conversion error.
fn try_from(conf: SockConfig<'a>) -> Result<Self, Self::Error>
[src]
fn try_from(conf: SockConfig<'a>) -> Result<Self, Self::Error>
try_from
)Performs the conversion.
impl<'a> TryFrom<SockConfig<'a>> for Req
[src]
impl<'a> TryFrom<SockConfig<'a>> for Req
type Error = Error
try_from
)The type returned in the event of a conversion error.
fn try_from(conf: SockConfig<'a>) -> Result<Self, Self::Error>
[src]
fn try_from(conf: SockConfig<'a>) -> Result<Self, Self::Error>
try_from
)Performs the conversion.
impl<'a> TryFrom<SockConfig<'a>> for Router
[src]
impl<'a> TryFrom<SockConfig<'a>> for Router
type Error = Error
try_from
)The type returned in the event of a conversion error.
fn try_from(conf: SockConfig<'a>) -> Result<Self, Self::Error>
[src]
fn try_from(conf: SockConfig<'a>) -> Result<Self, Self::Error>
try_from
)Performs the conversion.
impl<'a> TryFrom<SockConfig<'a>> for Xpub
[src]
impl<'a> TryFrom<SockConfig<'a>> for Xpub
type Error = Error
try_from
)The type returned in the event of a conversion error.
fn try_from(conf: SockConfig<'a>) -> Result<Self, Self::Error>
[src]
fn try_from(conf: SockConfig<'a>) -> Result<Self, Self::Error>
try_from
)Performs the conversion.
impl<'a> TryFrom<SockConfig<'a>> for Xsub
[src]
impl<'a> TryFrom<SockConfig<'a>> for Xsub
Auto Trait Implementations
impl<'a> Send for SockConfig<'a>
impl<'a> Send for SockConfig<'a>
impl<'a> Sync for SockConfig<'a>
impl<'a> Sync for SockConfig<'a>