Struct DatagramMetadata
#[non_exhaustive]pub struct DatagramMetadata {
pub len: usize,
pub original_len: usize,
pub segment_size: Option<NonZero<usize>>,
pub peer: SocketAddress,
pub local: SocketAddress,
pub original_destination: Option<SocketAddress>,
pub interface_index: Option<u32>,
pub ecn: Option<EcnCodepoint>,
pub timestamp: Option<ReceiveTimestamp>,
pub truncated: bool,
}std and udp only.Expand description
Metadata associated with one receive buffer.
A buffer normally contains one UDP datagram. When receive coalescing is in
use, it can contain several non-empty datagrams separated at
segment_size byte boundaries; only the final segment may be shorter.
With no truncation, len is the sum of those segment lengths. A zero-length
datagram is always represented alone with no segment size.
truncated applies to the entire received socket entry. If it is true, the
copied bytes are only an incomplete prefix of the datagram or coalesced
group and consumers must discard the whole entry rather than parse partial
segments. original_len is the kernel-reported pre-truncation size when the
platform makes it available.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.len: usizeNumber of bytes copied into the receive buffer.
original_len: usizeOriginal number of bytes reported by the socket before truncation.
Some platforms cannot report the original size and use len here.
segment_size: Option<NonZero<usize>>Size of each coalesced datagram except possibly the last.
None represents exactly one datagram, including a zero-length datagram.
peer: SocketAddressSource address of the datagram.
local: SocketAddressEffective local address of the socket for this datagram.
On platforms without destination-address ancillary data this can retain an unspecified IP when the socket was bound to a wildcard address.
original_destination: Option<SocketAddress>Original destination supplied by a transparent-proxy facility, if enabled.
interface_index: Option<u32>Index of the interface on which the datagram was received.
ecn: Option<EcnCodepoint>Received ECN codepoint, or None when the platform did not report it.
Some(EcnCodepoint::NotEct) is deliberately distinct from unavailable.
timestamp: Option<ReceiveTimestamp>Kernel or implementation receive time, including its clock domain.
truncated: boolWhether the datagram did not fit in the supplied buffer.
Implementations§
§impl DatagramMetadata
impl DatagramMetadata
pub const fn empty() -> DatagramMetadata
pub const fn empty() -> DatagramMetadata
Construct an empty metadata slot to be filled by a receive operation.
pub fn segment_count(&self) -> usize
pub fn segment_count(&self) -> usize
Number of complete or partial segment regions in the copied bytes.
This is the actual datagram count only when truncated is false.
A truncated entry must be discarded as a whole.
Trait Implementations§
§impl Clone for DatagramMetadata
impl Clone for DatagramMetadata
§fn clone(&self) -> DatagramMetadata
fn clone(&self) -> DatagramMetadata
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for DatagramMetadata
§impl Debug for DatagramMetadata
impl Debug for DatagramMetadata
§impl Default for DatagramMetadata
impl Default for DatagramMetadata
§fn default() -> DatagramMetadata
fn default() -> DatagramMetadata
impl Eq for DatagramMetadata
§impl PartialEq for DatagramMetadata
impl PartialEq for DatagramMetadata
impl StructuralPartialEq for DatagramMetadata
Auto Trait Implementations§
impl Freeze for DatagramMetadata
impl RefUnwindSafe for DatagramMetadata
impl Send for DatagramMetadata
impl Sync for DatagramMetadata
impl Unpin for DatagramMetadata
impl UnsafeUnpin for DatagramMetadata
impl UnwindSafe for DatagramMetadata
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a rama_grpc::Request§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§fn and<P, B, E>(self, other: P) -> And<T, P>
fn and<P, B, E>(self, other: P) -> And<T, P>
Policy that returns Action::Follow only if self and other return
Action::Follow. Read more