pub struct DialerBuilder { /* private fields */ }
Expand description
Configuration utility for NNG dialers.
This object allows for the configuration of dialers before they are
started. If it is not necessary to change dialer settings or to close the
dialer without closing the socket, then Socket::dial
provides a simpler
interface.
Implementations§
Source§impl DialerBuilder
impl DialerBuilder
Sourcepub fn new(socket: &Socket, url: &str) -> Result<Self>
pub fn new(socket: &Socket, url: &str) -> Result<Self>
Creates a new dialer object associated with the given socket.
Note that this does not start the dialer. In order to start the dialer,
this object must be consumed by DialerBuilder::start
.
§Errors
AddressInvalid
: An invalid url was specified.Closed
: The socket is not open.OutOfMemory
: Insufficient memory available.
Sourcepub fn start(self, nonblocking: bool) -> Result<Dialer, (Self, Error)>
pub fn start(self, nonblocking: bool) -> Result<Dialer, (Self, Error)>
Cause the dialer to start connecting to the address with which it was created.
Normally, the first attempt to connect to the dialer’s address is done synchronously, including any necessary name resolution. As a result, a failure, such as if the connection is refused, will be returned immediately, and no further action will be taken.
However, if nonblocking
is specified, then the connection attempt is
made asynchronously.
Furthermore, if the connection was closed for a synchronously dialed connection, the dialer will still attempt to redial asynchronously.
The returned handle controls the life of the dialer. If it is dropped, the dialer is shut down and no more messages will be received on it.
§Errors
Closed
: The socket is not open.ConnectionRefused
: The remote peer refused the connection.ConnectionReset
: The remote peer reset the connection.DestUnreachable
: The remote address is not reachable.OutOfMemory
: Insufficient memory available.PeerAuth
: Authentication or authorization failure.Protocol
: A protocol error occurred.