pub struct FragmentOffset(/* private fields */);
Expand description
An IP fragment offset.
Represents a fragment offset found in an IP header. The offset is expressed
in units of 8 octets and must be smaller than 1 << 13
.
This is valid for both IPv4 (RFC 791 Section 3.1) and IPv6 (RFC 8200 Section 4.5) headers.
Implementations§
Source§impl FragmentOffset
impl FragmentOffset
Sourcepub const ZERO: FragmentOffset = _
pub const ZERO: FragmentOffset = _
The zero fragment offset.
Sourcepub const fn new(offset: u16) -> Option<Self>
pub const fn new(offset: u16) -> Option<Self>
Creates a new offset from a raw u16 value.
Returns None
if offset
is not smaller than 1 << 13
.
Sourcepub const fn new_with_bytes(offset_bytes: u16) -> Option<Self>
pub const fn new_with_bytes(offset_bytes: u16) -> Option<Self>
Creates a new offset from a raw bytes value.
Returns None
if offset_bytes
is not a multiple of 8
.
Sourcepub const fn into_raw(self) -> u16
pub const fn into_raw(self) -> u16
Consumes self
returning the raw offset value in 8-octets multiples.
Sourcepub fn into_bytes(self) -> u16
pub fn into_bytes(self) -> u16
Consumes self
returning the total number of bytes represented by this
offset.
Equal to 8 times the raw offset value.
Trait Implementations§
Source§impl Clone for FragmentOffset
impl Clone for FragmentOffset
Source§fn clone(&self) -> FragmentOffset
fn clone(&self) -> FragmentOffset
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for FragmentOffset
impl Debug for FragmentOffset
Source§impl Hash for FragmentOffset
impl Hash for FragmentOffset
Source§impl Ord for FragmentOffset
impl Ord for FragmentOffset
Source§fn cmp(&self, other: &FragmentOffset) -> Ordering
fn cmp(&self, other: &FragmentOffset) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for FragmentOffset
impl PartialEq for FragmentOffset
Source§impl PartialOrd for FragmentOffset
impl PartialOrd for FragmentOffset
impl Copy for FragmentOffset
impl Eq for FragmentOffset
impl StructuralPartialEq for FragmentOffset
Auto Trait Implementations§
impl Freeze for FragmentOffset
impl RefUnwindSafe for FragmentOffset
impl Send for FragmentOffset
impl Sync for FragmentOffset
impl Unpin for FragmentOffset
impl UnwindSafe for FragmentOffset
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)