Trait zeromq::Socket [−][src]
pub trait Socket: Sized + Send {
fn with_options(options: SocketOptions) -> Self;
fn backend(&self) -> Arc<dyn MultiPeerBackend>;
fn binds(&mut self) -> &mut HashMap<Endpoint, AcceptStopHandle>;
fn monitor(&mut self) -> Receiver<SocketEvent>;
fn new() -> Self { ... }
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,
{ ... }
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,
{ ... }
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,
{ ... }
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,
{ ... }
fn close<'async_trait>(
self
) -> Pin<Box<dyn Future<Output = Vec<ZmqError>> + Send + 'async_trait>>
where
Self: 'async_trait,
{ ... }
}
Required methods
fn with_options(options: SocketOptions) -> Self
fn backend(&self) -> Arc<dyn MultiPeerBackend>
fn monitor(&mut self) -> Receiver<SocketEvent>
fn monitor(&mut self) -> Receiver<SocketEvent>
Creates and setups new socket monitor
Subsequent calls to this method each create a new monitor channel. Sender side of previous one is dropped.
Provided methods
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).
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
Unbinds all bound endpoints, blocking until finished.
Connects to the given endpoint.
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.