pub struct UdpSocket { /* private fields */ }Expand description
RAII wrapper around a UDP (datagram) socket.
Uses inline storage for the socket backend, so no heap/zero-heap split is
needed. The handle is derived from &self.storage at each call to
avoid dangling self-referential pointers after Rust moves the struct.
Implementations§
Source§impl UdpSocket
impl UdpSocket
Sourcepub fn bind(&self, addr: &Address) -> Result<()>
pub fn bind(&self, addr: &Address) -> Result<()>
Bind the socket to a local address.
§Errors
Returns an error if the bind fails (e.g. address already in use).
Trait Implementations§
impl Send for UdpSocket
impl Sync for UdpSocket
Auto Trait Implementations§
impl Freeze for UdpSocket
impl RefUnwindSafe for UdpSocket
impl Unpin for UdpSocket
impl UnwindSafe for UdpSocket
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more