#[non_exhaustive]pub struct PacketMeta {}
Expand description
Metadata associated to a packet.
The packet metadata is a set of attributes associated to network packets
as they travel up or down the stack. The metadata is get/set by the
Device
implementations or by the user when sending/receiving packets from a
socket.
Metadata fields are enabled via Cargo features. If no field is enabled, this struct becomes zero-sized, which allows the compiler to optimize it out as if the packet metadata mechanism didn’t exist at all.
Currently only UDP sockets allow setting/retrieving packet metadata. The metadata for packets emitted with other sockets will be all default values.
This struct is marked as #[non_exhaustive]
. This means it is not possible to
create it directly by specifying all fields. You have to instead create it with
default values and then set the fields you want. This makes adding metadata
fields a non-breaking change.
let mut meta = smoltcp::phy::PacketMeta::default();
#[cfg(feature = "packetmeta-id")]
{
meta.id = 15;
}
Trait Implementations§
Source§impl Clone for PacketMeta
impl Clone for PacketMeta
Source§fn clone(&self) -> PacketMeta
fn clone(&self) -> PacketMeta
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more