pub struct Header { /* private fields */ }Implementations§
Source§impl Header
impl Header
pub fn new<vihl: Into<Vihl>, tos: Into<Tos>, total_len: Into<U16>, id: Into<U16>, flag_fragment: Into<FlagFragment>, ttl: Into<u8>, protocol: Into<Protocol>, checksum: Into<U16>, source: Into<IpV4Address>, destination: Into<IpV4Address>>( vihl: vihl, tos: tos, total_len: total_len, id: id, flag_fragment: flag_fragment, ttl: ttl, protocol: protocol, checksum: checksum, source: source, destination: destination, ) -> Self
pub fn as_bytes(&self) -> &[u8] ⓘ
pub fn as_bytes_mut(&mut self) -> &mut [u8] ⓘ
Source§impl Header
impl Header
pub const fn vihl(&self) -> &Vihl
pub fn vihl_mut(&mut self) -> &mut Vihl
pub const fn tos(&self) -> &Tos
pub fn tos_mut(&mut self) -> &mut Tos
pub const fn total_len(&self) -> &U16
pub fn total_len_mut(&mut self) -> &mut U16
pub const fn id(&self) -> &U16
pub fn id_mut(&mut self) -> &mut U16
pub const fn flag_fragment(&self) -> &FlagFragment
pub fn flag_fragment_mut(&mut self) -> &mut FlagFragment
pub const fn ttl(&self) -> &u8
pub fn ttl_mut(&mut self) -> &mut u8
pub const fn protocol(&self) -> &Protocol
pub fn protocol_mut(&mut self) -> &mut Protocol
pub const fn checksum(&self) -> &U16
pub fn checksum_mut(&mut self) -> &mut U16
pub const fn source(&self) -> &IpV4Address
pub fn source_mut(&mut self) -> &mut IpV4Address
pub const fn destination(&self) -> &IpV4Address
pub fn destination_mut(&mut self) -> &mut IpV4Address
pub fn update_checksum(&mut self)
Trait Implementations§
Source§impl<'a> DecoderValue<'a> for &'a Header
impl<'a> DecoderValue<'a> for &'a Header
fn decode(buffer: DecoderBuffer<'a>) -> DecoderBufferResult<'a, Self>
Source§impl<'a> DecoderValue<'a> for Header
impl<'a> DecoderValue<'a> for Header
fn decode(buffer: DecoderBuffer<'a>) -> DecoderBufferResult<'a, Self>
Source§impl<'a> DecoderValueMut<'a> for &'a Header
impl<'a> DecoderValueMut<'a> for &'a Header
fn decode_mut(buffer: DecoderBufferMut<'a>) -> DecoderBufferMutResult<'a, Self>
Source§impl<'a> DecoderValueMut<'a> for &'a mut Header
impl<'a> DecoderValueMut<'a> for &'a mut Header
fn decode_mut(buffer: DecoderBufferMut<'a>) -> DecoderBufferMutResult<'a, Self>
Source§impl<'a> DecoderValueMut<'a> for Header
impl<'a> DecoderValueMut<'a> for Header
fn decode_mut(buffer: DecoderBufferMut<'a>) -> DecoderBufferMutResult<'a, Self>
Source§impl<'a> EncoderValue for &'a Header
impl<'a> EncoderValue for &'a Header
Source§fn encoding_size(&self) -> usize
fn encoding_size(&self) -> usize
Returns the encoding size with no buffer constrains
Source§fn encoding_size_for_encoder<E: Encoder>(&self, _encoder: &E) -> usize
fn encoding_size_for_encoder<E: Encoder>(&self, _encoder: &E) -> usize
Returns the encoding size for the given encoder’s capacity
Source§fn encode_mut<E>(&mut self, encoder: &mut E)where
E: Encoder,
fn encode_mut<E>(&mut self, encoder: &mut E)where
E: Encoder,
Encodes the value into the encoder, while potentially mutating the value itself
Source§fn encode_with_len_prefix<Len, E>(&self, encoder: &mut E)
fn encode_with_len_prefix<Len, E>(&self, encoder: &mut E)
Encodes the value into the encoder with a prefix of
Lenfn encode_to_vec(&self) -> Vec<u8> ⓘ
Source§impl<'a> EncoderValue for &'a mut Header
impl<'a> EncoderValue for &'a mut Header
Source§fn encoding_size(&self) -> usize
fn encoding_size(&self) -> usize
Returns the encoding size with no buffer constrains
Source§fn encoding_size_for_encoder<E: Encoder>(&self, _encoder: &E) -> usize
fn encoding_size_for_encoder<E: Encoder>(&self, _encoder: &E) -> usize
Returns the encoding size for the given encoder’s capacity
Source§fn encode_mut<E>(&mut self, encoder: &mut E)where
E: Encoder,
fn encode_mut<E>(&mut self, encoder: &mut E)where
E: Encoder,
Encodes the value into the encoder, while potentially mutating the value itself
Source§fn encode_with_len_prefix<Len, E>(&self, encoder: &mut E)
fn encode_with_len_prefix<Len, E>(&self, encoder: &mut E)
Encodes the value into the encoder with a prefix of
Lenfn encode_to_vec(&self) -> Vec<u8> ⓘ
Source§impl EncoderValue for Header
impl EncoderValue for Header
Source§fn encoding_size(&self) -> usize
fn encoding_size(&self) -> usize
Returns the encoding size with no buffer constrains
Source§fn encoding_size_for_encoder<E: Encoder>(&self, _encoder: &E) -> usize
fn encoding_size_for_encoder<E: Encoder>(&self, _encoder: &E) -> usize
Returns the encoding size for the given encoder’s capacity
Source§fn encode_mut<E>(&mut self, encoder: &mut E)where
E: Encoder,
fn encode_mut<E>(&mut self, encoder: &mut E)where
E: Encoder,
Encodes the value into the encoder, while potentially mutating the value itself
Source§fn encode_with_len_prefix<Len, E>(&self, encoder: &mut E)
fn encode_with_len_prefix<Len, E>(&self, encoder: &mut E)
Encodes the value into the encoder with a prefix of
Lenfn encode_to_vec(&self) -> Vec<u8> ⓘ
Source§impl FromBytes for Header
impl FromBytes for Header
Source§impl IntoBytes for Header
impl IntoBytes for Header
Source§fn as_mut_bytes(&mut self) -> &mut [u8] ⓘwhere
Self: FromBytes,
fn as_mut_bytes(&mut self) -> &mut [u8] ⓘwhere
Self: FromBytes,
Gets the bytes of this value mutably. Read more
Source§fn write_to(&self, dst: &mut [u8]) -> Result<(), SizeError<&Self, &mut [u8]>>where
Self: Immutable,
fn write_to(&self, dst: &mut [u8]) -> Result<(), SizeError<&Self, &mut [u8]>>where
Self: Immutable,
Source§impl Ord for Header
impl Ord for Header
Source§impl PartialOrd for Header
impl PartialOrd for Header
Source§impl TryFromBytes for Headerwhere
Vihl: TryFromBytes,
Tos: TryFromBytes,
U16: TryFromBytes,
FlagFragment: TryFromBytes,
u8: TryFromBytes,
Protocol: TryFromBytes,
IpV4Address: TryFromBytes,
impl TryFromBytes for Headerwhere
Vihl: TryFromBytes,
Tos: TryFromBytes,
U16: TryFromBytes,
FlagFragment: TryFromBytes,
u8: TryFromBytes,
Protocol: TryFromBytes,
IpV4Address: TryFromBytes,
Source§fn try_read_from_bytes(
source: &[u8],
) -> Result<Self, ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: Sized,
fn try_read_from_bytes(
source: &[u8],
) -> Result<Self, ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: Sized,
Source§fn try_read_from_prefix(
source: &[u8],
) -> Result<(Self, &[u8]), ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: Sized,
fn try_read_from_prefix(
source: &[u8],
) -> Result<(Self, &[u8]), ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: Sized,
Source§fn try_read_from_suffix(
source: &[u8],
) -> Result<(&[u8], Self), ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: Sized,
fn try_read_from_suffix(
source: &[u8],
) -> Result<(&[u8], Self), ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: Sized,
impl Copy for Header
impl Eq for Header
impl Immutable for Header
impl StructuralPartialEq for Header
impl Unaligned for Header
Auto Trait Implementations§
impl Freeze for Header
impl RefUnwindSafe for Header
impl Send for Header
impl Sync for Header
impl Unpin for Header
impl UnwindSafe for Header
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§impl<T> PacketPayloadEncoder for Twhere
T: EncoderValue,
impl<T> PacketPayloadEncoder for Twhere
T: EncoderValue,
Source§fn encoding_size_hint<E>(&mut self, encoder: &E, minimum_len: usize) -> usizewhere
E: Encoder,
fn encoding_size_hint<E>(&mut self, encoder: &E, minimum_len: usize) -> usizewhere
E: Encoder,
Returns an estimate of the encoding size of the payload. This
may be inaccurate from what actually is encoded. Estimates should
be less than or equal to what is actually written.
Implementations can return 0 to skip encoding.