[][src]Trait zeromq::Socket

pub trait Socket: Sized + Send {
    pub fn new() -> Self;
pub fn backend(&self) -> Arc<dyn MultiPeerBackend>;
pub fn binds(&mut self) -> &mut HashMap<Endpoint, AcceptStopHandle>;
pub fn monitor(&mut self) -> Receiver<SocketEvent>; #[must_use] pub fn bind<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        endpoint: &'life1 str
    ) -> Pin<Box<dyn Future<Output = ZmqResult<Endpoint>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        'life1: 'async_trait,
        Self: 'async_trait
, { ... }
#[must_use] pub fn unbind<'life0, 'async_trait>(
        &'life0 mut self,
        endpoint: Endpoint
    ) -> Pin<Box<dyn Future<Output = ZmqResult<()>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
, { ... }
#[must_use] pub fn unbind_all<'life0, 'async_trait>(
        &'life0 mut self
    ) -> Pin<Box<dyn Future<Output = Vec<ZmqError>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
, { ... }
#[must_use] pub fn connect<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        endpoint: &'life1 str
    ) -> Pin<Box<dyn Future<Output = ZmqResult<()>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        'life1: 'async_trait,
        Self: 'async_trait
, { ... }
#[must_use] pub fn close<'async_trait>(
        self
    ) -> Pin<Box<dyn Future<Output = Vec<ZmqError>> + Send + 'async_trait>>
    where
        Self: 'async_trait
, { ... } }

Required methods

pub fn new() -> Self[src]

pub fn backend(&self) -> Arc<dyn MultiPeerBackend>[src]

pub fn binds(&mut self) -> &mut HashMap<Endpoint, AcceptStopHandle>[src]

pub fn monitor(&mut self) -> Receiver<SocketEvent>[src]

Creates and setups new socket monitor

Subsequent calls to this method each create a new monitor channel. Sender side of previous one is dropped.

Loading content...

Provided methods

#[must_use]pub fn bind<'life0, 'life1, 'async_trait>(
    &'life0 mut self,
    endpoint: &'life1 str
) -> Pin<Box<dyn Future<Output = ZmqResult<Endpoint>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    'life1: 'async_trait,
    Self: 'async_trait, 
[src]

Binds to the endpoint and starts a coroutine to accept new connections on it.

Returns the endpoint resolved to the exact bound location if applicable (port # resolved, for example).

#[must_use]pub fn unbind<'life0, 'async_trait>(
    &'life0 mut self,
    endpoint: Endpoint
) -> Pin<Box<dyn Future<Output = ZmqResult<()>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 
[src]

Unbinds the endpoint, blocking until the associated endpoint is no longer in use

Errors

May give a ZmqError::NoSuchBind if endpoint isn't bound. May also give any other zmq errors encountered when attempting to disconnect

#[must_use]pub fn unbind_all<'life0, 'async_trait>(
    &'life0 mut self
) -> Pin<Box<dyn Future<Output = Vec<ZmqError>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 
[src]

Unbinds all bound endpoints, blocking until finished.

#[must_use]pub fn connect<'life0, 'life1, 'async_trait>(
    &'life0 mut self,
    endpoint: &'life1 str
) -> Pin<Box<dyn Future<Output = ZmqResult<()>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    'life1: 'async_trait,
    Self: 'async_trait, 
[src]

Connects to the given endpoint.

#[must_use]pub fn close<'async_trait>(
    self
) -> Pin<Box<dyn Future<Output = Vec<ZmqError>> + Send + 'async_trait>> where
    Self: 'async_trait, 
[src]

Disconnects from the given endpoint, blocking until finished.

Errors

May give a ZmqError::NoSuchConnection if endpoint isn't connected. May also give any other zmq errors encountered when attempting to disconnect. Disconnects all connecttions, blocking until finished. Closes the socket, blocking until all associated binds are closed. This is equivalent to drop(), but with the benefit of blocking until resources are released, and getting any underlying errors.

Returns any encountered errors.

Loading content...

Implementors

impl Socket for DealerSocket[src]

impl Socket for PubSocket[src]

impl Socket for PullSocket[src]

impl Socket for PushSocket[src]

impl Socket for RepSocket[src]

impl Socket for ReqSocket[src]

impl Socket for RouterSocket[src]

impl Socket for SubSocket[src]

Loading content...