pub struct UdpSocketState { /* private fields */ }
Expand description
Tokio-compatible UDP socket with some useful specializations.
Unlike a standard tokio UDP socket, this allows ECN bits to be read and written on some platforms.
Implementations§
Source§impl UdpSocketState
impl UdpSocketState
pub fn new(sock: UdpSockRef<'_>) -> Result<Self>
pub fn send( &self, socket: UdpSockRef<'_>, transmit: &Transmit<'_>, ) -> Result<()>
pub fn recv( &self, socket: UdpSockRef<'_>, bufs: &mut [IoSliceMut<'_>], meta: &mut [RecvMeta], ) -> Result<usize>
Sourcepub fn max_gso_segments(&self) -> usize
pub fn max_gso_segments(&self) -> usize
The maximum amount of segments which can be transmitted if a platform supports Generic Send Offload (GSO).
This is 1 if the platform doesn’t support GSO. Subject to change if errors are detected while using GSO.
Sourcepub fn gro_segments(&self) -> usize
pub fn gro_segments(&self) -> usize
The number of segments to read when GRO is enabled. Used as a factor to compute the receive buffer size.
Returns 1 if the platform doesn’t support GRO.
Sourcepub fn may_fragment(&self) -> bool
pub fn may_fragment(&self) -> bool
Whether transmitted datagrams might get fragmented by the IP layer
Returns false
on targets which employ e.g. the IPV6_DONTFRAG
socket option.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for UdpSocketState
impl RefUnwindSafe for UdpSocketState
impl Send for UdpSocketState
impl Sync for UdpSocketState
impl Unpin for UdpSocketState
impl UnwindSafe for UdpSocketState
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