Struct s2n_quic_core::inet::ipv4::IpV4Address
source · [−]#[repr(C)]pub struct IpV4Address { /* private fields */ }Implementations
sourceimpl IpV4Address
impl IpV4Address
sourcepub const UNSPECIFIED: Self = Self {
octets: [0; IPV4_LEN],
}
pub const UNSPECIFIED: Self = Self { octets: [0; IPV4_LEN], }
An unspecified IpV4Address
sourcepub const fn unicast_scope(self) -> Option<UnicastScope>
pub const fn unicast_scope(self) -> Option<UnicastScope>
Returns the ip::UnicastScope for the given address
See the IANA Registry for more details.
use s2n_quic_core::inet::{IpV4Address, ip::UnicastScope::*};
assert_eq!(IpV4Address::from([0, 0, 0, 0]).unicast_scope(), None);
assert_eq!(IpV4Address::from([127, 0, 0, 1]).unicast_scope(), Some(Loopback));
assert_eq!(IpV4Address::from([127, 1, 1, 1]).unicast_scope(), Some(Loopback));
assert_eq!(IpV4Address::from([10, 0, 0, 1]).unicast_scope(), Some(Private));
assert_eq!(IpV4Address::from([100, 64, 0, 1]).unicast_scope(), Some(Private));
assert_eq!(IpV4Address::from([169, 254, 1, 2]).unicast_scope(), Some(LinkLocal));
assert_eq!(IpV4Address::from([192, 0, 0, 1]).unicast_scope(), None);
assert_eq!(IpV4Address::from([192, 0, 0, 9]).unicast_scope(), Some(Global));
assert_eq!(IpV4Address::from([192, 0, 0, 10]).unicast_scope(), Some(Global));
assert_eq!(IpV4Address::from([192, 0, 2, 1]).unicast_scope(), None);
assert_eq!(IpV4Address::from([198, 18, 0, 0]).unicast_scope(), None);
assert_eq!(IpV4Address::from([198, 19, 1, 1]).unicast_scope(), None);
assert_eq!(IpV4Address::from([233, 252, 0, 1]).unicast_scope(), None);
assert_eq!(IpV4Address::from([240, 255, 255, 255]).unicast_scope(), None);
assert_eq!(IpV4Address::from([255, 255, 255, 255]).unicast_scope(), None);
assert_eq!(IpV4Address::from([92, 88, 99, 123]).unicast_scope(), Some(Global));
assert_eq!(IpV4Address::from([168, 254, 169, 253]).unicast_scope(), Some(Global));
assert_eq!(IpV4Address::from([224, 0, 0, 1]).unicast_scope(), Some(Global));sourcepub const fn to_ipv6_mapped(self) -> IpV6Address
pub const fn to_ipv6_mapped(self) -> IpV6Address
Converts the IP address into a IPv6 mapped address
Trait Implementations
sourceimpl AsBytes for IpV4Address
impl AsBytes for IpV4Address
sourcefn as_bytes(&self) -> &[u8]ⓘNotable traits for &[u8]impl<'_> Read for &[u8]impl<'_> Write for &mut [u8]
fn as_bytes(&self) -> &[u8]ⓘNotable traits for &[u8]impl<'_> Read for &[u8]impl<'_> Write for &mut [u8]
Gets the bytes of this value. Read more
sourcefn as_bytes_mut(&mut self) -> &mut [u8]ⓘNotable traits for &[u8]impl<'_> Read for &[u8]impl<'_> Write for &mut [u8] where
Self: FromBytes,
fn as_bytes_mut(&mut self) -> &mut [u8]ⓘNotable traits for &[u8]impl<'_> Read for &[u8]impl<'_> Write for &mut [u8] where
Self: FromBytes,
Gets the bytes of this value mutably. Read more
sourcefn write_to<B>(&self, bytes: B) -> Option<()> where
B: ByteSliceMut,
fn write_to<B>(&self, bytes: B) -> Option<()> where
B: ByteSliceMut,
Writes a copy of self to bytes. Read more
sourcefn write_to_prefix<B>(&self, bytes: B) -> Option<()> where
B: ByteSliceMut,
fn write_to_prefix<B>(&self, bytes: B) -> Option<()> where
B: ByteSliceMut,
Writes a copy of self to the prefix of bytes. Read more
sourcefn write_to_suffix<B>(&self, bytes: B) -> Option<()> where
B: ByteSliceMut,
fn write_to_suffix<B>(&self, bytes: B) -> Option<()> where
B: ByteSliceMut,
Writes a copy of self to the suffix of bytes. Read more
sourceimpl Clone for IpV4Address
impl Clone for IpV4Address
sourcefn clone(&self) -> IpV4Address
fn clone(&self) -> IpV4Address
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read more
sourceimpl Debug for IpV4Address
impl Debug for IpV4Address
sourceimpl<'a> DecoderValue<'a> for IpV4Address
impl<'a> DecoderValue<'a> for IpV4Address
fn decode(buffer: DecoderBuffer<'a>) -> DecoderBufferResult<'_, Self>
sourceimpl<'a> DecoderValue<'a> for &'a IpV4Address
impl<'a> DecoderValue<'a> for &'a IpV4Address
fn decode(buffer: DecoderBuffer<'a>) -> DecoderBufferResult<'_, Self>
sourceimpl<'a> DecoderValueMut<'a> for IpV4Address
impl<'a> DecoderValueMut<'a> for IpV4Address
fn decode_mut(buffer: DecoderBufferMut<'a>) -> DecoderBufferMutResult<'_, Self>
sourceimpl<'a> DecoderValueMut<'a> for &'a IpV4Address
impl<'a> DecoderValueMut<'a> for &'a IpV4Address
fn decode_mut(buffer: DecoderBufferMut<'a>) -> DecoderBufferMutResult<'a, Self>
sourceimpl<'a> DecoderValueMut<'a> for &'a mut IpV4Address
impl<'a> DecoderValueMut<'a> for &'a mut IpV4Address
fn decode_mut(buffer: DecoderBufferMut<'a>) -> DecoderBufferMutResult<'a, Self>
sourceimpl Default for IpV4Address
impl Default for IpV4Address
sourcefn default() -> IpV4Address
fn default() -> IpV4Address
Returns the “default value” for a type. Read more
sourceimpl Display for IpV4Address
impl Display for IpV4Address
sourceimpl EncoderValue for IpV4Address
impl EncoderValue for IpV4Address
sourcefn encoding_size(&self) -> usize
fn encoding_size(&self) -> usize
Returns the encoding size with no buffer constrains
sourcefn 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
sourcefn 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
sourceimpl<'a> EncoderValue for &'a IpV4Address
impl<'a> EncoderValue for &'a IpV4Address
sourcefn encoding_size(&self) -> usize
fn encoding_size(&self) -> usize
Returns the encoding size with no buffer constrains
sourcefn 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
sourcefn 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
sourceimpl<'a> EncoderValue for &'a mut IpV4Address
impl<'a> EncoderValue for &'a mut IpV4Address
sourcefn encoding_size(&self) -> usize
fn encoding_size(&self) -> usize
Returns the encoding size with no buffer constrains
sourcefn 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
sourcefn 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
sourceimpl<'a> From<&'a IpV4Address> for IpAddressRef<'a>
impl<'a> From<&'a IpV4Address> for IpAddressRef<'a>
sourcefn from(ip: &'a IpV4Address) -> Self
fn from(ip: &'a IpV4Address) -> Self
Converts to this type from the input type.
sourceimpl From<&Ipv4Addr> for IpV4Address
impl From<&Ipv4Addr> for IpV4Address
sourceimpl From<IpV4Address> for IpAddress
impl From<IpV4Address> for IpAddress
sourcefn from(ip: IpV4Address) -> Self
fn from(ip: IpV4Address) -> Self
Converts to this type from the input type.
sourceimpl From<IpV4Address> for [u8; 4]
impl From<IpV4Address> for [u8; 4]
sourcefn from(address: IpV4Address) -> Self
fn from(address: IpV4Address) -> Self
Converts to this type from the input type.
sourceimpl From<IpV4Address> for Ipv4Addr
impl From<IpV4Address> for Ipv4Addr
sourcefn from(address: IpV4Address) -> Self
fn from(address: IpV4Address) -> Self
Converts to this type from the input type.
sourceimpl From<Ipv4Addr> for IpV4Address
impl From<Ipv4Addr> for IpV4Address
sourceimpl FromBytes for IpV4Address
impl FromBytes for IpV4Address
sourcefn read_from<B>(bytes: B) -> Option<Self> where
B: ByteSlice,
fn read_from<B>(bytes: B) -> Option<Self> where
B: ByteSlice,
Reads a copy of Self from bytes. Read more
sourcefn read_from_prefix<B>(bytes: B) -> Option<Self> where
B: ByteSlice,
fn read_from_prefix<B>(bytes: B) -> Option<Self> where
B: ByteSlice,
Reads a copy of Self from the prefix of bytes. Read more
sourcefn read_from_suffix<B>(bytes: B) -> Option<Self> where
B: ByteSlice,
fn read_from_suffix<B>(bytes: B) -> Option<Self> where
B: ByteSlice,
Reads a copy of Self from the suffix of bytes. Read more
sourcefn new_zeroed() -> Self
fn new_zeroed() -> Self
Creates an instance of Self from zeroed bytes.
sourceimpl Hash for IpV4Address
impl Hash for IpV4Address
sourceimpl Ord for IpV4Address
impl Ord for IpV4Address
sourceimpl PartialEq<IpV4Address> for IpV4Address
impl PartialEq<IpV4Address> for IpV4Address
sourceimpl PartialOrd<IpV4Address> for IpV4Address
impl PartialOrd<IpV4Address> for IpV4Address
sourcefn partial_cmp(&self, other: &Self) -> Option<Ordering>
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
This method returns an ordering between self and other values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self and other) and is used by the <=
operator. Read more
sourceimpl Unspecified for IpV4Address
impl Unspecified for IpV4Address
sourcefn is_unspecified(&self) -> bool
fn is_unspecified(&self) -> bool
Returns true if the value is unspecified
sourcefn filter_unspecified(self) -> Option<Self>
fn filter_unspecified(self) -> Option<Self>
Coerce a potentially unspecified value into an Option
impl Copy for IpV4Address
impl Eq for IpV4Address
impl StructuralEq for IpV4Address
impl Unaligned for IpV4Address
Auto Trait Implementations
impl RefUnwindSafe for IpV4Address
impl Send for IpV4Address
impl Sync for IpV4Address
impl Unpin for IpV4Address
impl UnwindSafe for IpV4Address
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> PacketPayloadEncoder for T where
T: EncoderValue,
impl<T> PacketPayloadEncoder for T where
T: EncoderValue,
sourcefn encoding_size_hint<E>(&mut self, encoder: &E, minimum_len: usize) -> usize where
E: Encoder,
fn encoding_size_hint<E>(&mut self, encoder: &E, minimum_len: usize) -> usize where
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. Read more