Improve endpoint construction docs

This commit is contained in:
Benjamin Saunders
2020-05-10 13:14:36 -07:00
committed by Dirkjan Ochtman
parent 6f9e20cf64
commit 0247c7d644
+6 -2
View File
@@ -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,