pub struct Datagram {
pub len: usize,
pub from: SocketAddr,
pub truncated: bool,
pub destination: Option<IpAddr>,
}Available on crate feature
udp only.Expand description
One received datagram.
let d = net_io::Datagram { len: 3, from: "127.0.0.1:9".parse().unwrap(), truncated: false, destination: None };
assert!(!d.truncated);Fields§
§len: usizeIts length. When truncated: the real length on Linux, the bytes copied
(the buffer’s length) elsewhere; never index the buffer with it then.
from: SocketAddrIts source, normalized.
truncated: boolIt did not fit the buffer and was cut.
destination: Option<IpAddr>The local address it was sent to (packet info, 0.6.0; always None before).
Trait Implementations§
impl Copy for Datagram
impl Eq for Datagram
impl StructuralPartialEq for Datagram
Auto Trait Implementations§
impl Freeze for Datagram
impl RefUnwindSafe for Datagram
impl Send for Datagram
impl Sync for Datagram
impl Unpin for Datagram
impl UnsafeUnpin for Datagram
impl UnwindSafe for Datagram
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