mirror of
https://github.com/n0-computer/noq.git
synced 2026-09-23 11:45:25 +00:00
Improve endpoint construction docs
This commit is contained in:
committed by
Dirkjan Ochtman
parent
6f9e20cf64
commit
0247c7d644
@@ -40,13 +40,17 @@ where
|
||||
|
||||
/// Build an endpoint bound to `addr`
|
||||
///
|
||||
/// Must be called from within a tokio runtime context.
|
||||
/// Must be called from within a tokio runtime context. To avoid consuming the
|
||||
/// `EndpointBuilder`, call `clone()` first.
|
||||
pub fn bind(self, addr: &SocketAddr) -> Result<(Endpoint<S>, Incoming<S>), EndpointError> {
|
||||
let socket = std::net::UdpSocket::bind(addr).map_err(EndpointError::Socket)?;
|
||||
self.with_socket(socket)
|
||||
}
|
||||
|
||||
/// Build an endpoint around a pre-configured socket.
|
||||
/// Build an endpoint around a pre-configured socket
|
||||
///
|
||||
/// Must be called from within a tokio runtime context. To avoid consuming the
|
||||
/// `EndpointBuilder`, call `clone()` first.
|
||||
pub fn with_socket(
|
||||
self,
|
||||
socket: std::net::UdpSocket,
|
||||
|
||||
Reference in New Issue
Block a user