net_types::ip

Enum Ipv4

Source
pub enum Ipv4 {}
Expand description

IPv4.

Ipv4 implements Ip for IPv4.

Note that this type has no value constructor. It is used purely at the type level. Attempting to construct it by calling Default::default will panic.

Implementations§

Source§

impl Ipv4

Source

pub const LIMITED_BROADCAST_ADDRESS: SpecifiedAddr<Ipv4Addr> = _

The limited broadcast address.

The limited broadcast address is considered to be a broadcast address on all networks regardless of subnet address. This is distinct from the subnet-specific broadcast address (e.g., 192.168.255.255 on the subnet 192.168.0.0/16). It is defined in the IANA IPv4 Special-Purpose Address Registry.

Source

pub const CLASS_A_SUBNET: Subnet<Ipv4Addr> = _

The Class A subnet.

The Class A subnet is defined in RFC 1812 section 2.2.5.1.

Source

pub const CLASS_B_SUBNET: Subnet<Ipv4Addr> = _

The Class B subnet.

The Class B subnet is defined in RFC 1812 section 2.2.5.1.

Source

pub const CLASS_C_SUBNET: Subnet<Ipv4Addr> = _

The Class C subnet.

The Class C subnet is defined in RFC 1812 section 2.2.5.1.

Source

pub const CLASS_D_SUBNET: Subnet<Ipv4Addr> = _

The Class D subnet.

This subnet is also known as the multicast subnet.

The Class D subnet is defined in RFC 1812 section 2.2.5.1.

Source

pub const CLASS_E_SUBNET: Subnet<Ipv4Addr> = _

The Class E subnet.

The Class E subnet is meant for experimental purposes, and should not be used on the general internet. RFC 1812 Section 5.3.7 suggests that routers SHOULD discard packets with a source address in the Class E subnet. The Class E subnet is defined in RFC 1112 Section 4.

The subnet of link-local multicast addresses, outlined in RFC 5771 Section 4.

Source

pub const ALL_SYSTEMS_MULTICAST_ADDRESS: MulticastAddr<Ipv4Addr> = _

The multicast address subscribed to by all systems on the local network, defined in the IPv4 Multicast Address Space Registry.

Source

pub const ALL_ROUTERS_MULTICAST_ADDRESS: MulticastAddr<Ipv4Addr> = _

The multicast address subscribed to by all routers on the local network, defined in the IPv4 Multicast Address Space Registry.

Trait Implementations§

Source§

impl Clone for Ipv4

Source§

fn clone(&self) -> Ipv4

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Ipv4

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Ipv4

Source§

fn default() -> Ipv4

Returns the “default value” for a type. Read more
Source§

impl Hash for Ipv4

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Ip for Ipv4

Source§

const LOOPBACK_ADDRESS: SpecifiedAddr<Ipv4Addr> = _

The default IPv4 address used for loopback, defined in RFC 5735 Section 3.

Note that while this address is the most commonly used address for loopback traffic, any address in the LOOPBACK_SUBNET may be used.

Source§

const LOOPBACK_SUBNET: Subnet<Ipv4Addr> = _

The IPv4 loopback subnet, defined in RFC 1122 Section 3.2.1.3.

Source§

const MULTICAST_SUBNET: Subnet<Ipv4Addr> = Self::CLASS_D_SUBNET

The IPv4 Multicast subnet, defined in RFC 1112 Section 4.

The subnet of link-local unicast IPv4 addresses, outlined in RFC 3927 Section 2.1.

The IPv4 minimum link MTU.

Per RFC 791 Section 3.2, “[\e]very internet module must be able to forward a datagram of 68 octets without further fragmentation.”

Source§

const VERSION: IpVersion = IpVersion::V4

The IP version. Read more
Source§

const VERSION_MARKER: IpVersionMarker<Self> = _

The zero-sized-type IP version marker.
Source§

const UNSPECIFIED_ADDRESS: Ipv4Addr = _

The unspecified address. Read more
Source§

const NAME: &'static str = "IPv4"

“IPv4” or “IPv6”.
Source§

type Addr = Ipv4Addr

The address type for this IP version. Read more
Source§

fn map_ip<In: GenericOverIp<Self, Type = In> + GenericOverIp<Ipv4> + GenericOverIp<Ipv6>, Out: GenericOverIp<Self, Type = Out> + GenericOverIp<Ipv4> + GenericOverIp<Ipv6>>( input: In, v4: impl FnOnce(<In as GenericOverIp<Ipv4>>::Type) -> <Out as GenericOverIp<Ipv4>>::Type, _v6: impl FnOnce(<In as GenericOverIp<Ipv6>>::Type) -> <Out as GenericOverIp<Ipv6>>::Type, ) -> Out

Apply one of the given functions to the input and return the result. Read more
Source§

fn map_ip_in<In: GenericOverIp<Self, Type = In> + GenericOverIp<Ipv4> + GenericOverIp<Ipv6>, Out>( input: In, v4: impl FnOnce(<In as GenericOverIp<Ipv4>>::Type) -> Out, v6: impl FnOnce(<In as GenericOverIp<Ipv6>>::Type) -> Out, ) -> Out

Apply one of the given functions to the input and return the result. Read more
Source§

fn map_ip_out<In, Out: GenericOverIp<Self, Type = Out> + GenericOverIp<Ipv4> + GenericOverIp<Ipv6>>( input: In, v4: impl FnOnce(In) -> <Out as GenericOverIp<Ipv4>>::Type, v6: impl FnOnce(In) -> <Out as GenericOverIp<Ipv6>>::Type, ) -> Out

Apply one of the given functions to the input and return the result. Read more
Source§

impl Ord for Ipv4

Source§

fn cmp(&self, other: &Ipv4) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for Ipv4

Source§

fn eq(&self, other: &Ipv4) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for Ipv4

Source§

fn partial_cmp(&self, other: &Ipv4) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Copy for Ipv4

Source§

impl Eq for Ipv4

Source§

impl StructuralPartialEq for Ipv4

Auto Trait Implementations§

§

impl Freeze for Ipv4

§

impl RefUnwindSafe for Ipv4

§

impl Send for Ipv4

§

impl Sync for Ipv4

§

impl Unpin for Ipv4

§

impl UnwindSafe for Ipv4

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.