net_types::ip

Enum Ipv6

Source
pub enum Ipv6 {}
Expand description

IPv6.

Ipv6 implements Ip for IPv6.

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 Ipv6

Source

pub const LOOPBACK_IPV6_ADDRESS: UnicastAddr<Ipv6Addr> = _

The loopback address represented as a UnicastAddr.

This is equivalent to LOOPBACK_ADDRESS, except that it is a UnicastAddr witness type.

The IPv6 All Nodes multicast address in link-local scope, defined in RFC 4291 Section 2.7.1.

The IPv6 All Routers multicast address in link-local scope, defined in RFC 4291 Section 2.7.1.

Source

pub const SITE_LOCAL_UNICAST_SUBNET: Subnet<Ipv6Addr> = _

The (deprecated) subnet of site-local unicast addresses, defined in RFC 3513 Section 2.5.6.

The site-local unicast subnet was deprecated in RFC 3879:

The special behavior of this prefix MUST no longer be supported in new implementations. The prefix MUST NOT be reassigned for other use except by a future IETF standards action… However, router implementations SHOULD be configured to prevent routing of this prefix by default.

Source

pub const UNICAST_INTERFACE_IDENTIFIER_BITS: u8 = 64u8

The length, in bits, of the interface identifier portion of unicast IPv6 addresses except for addresses which start with the binary value 000.

According to RFC 4291 Section 2.5.1, “[f]or all unicast addresses, except those that start with the binary value 000, Interface IDs are required to be 64 bits.”

Note that, per RFC 4862 Section 5.5.3:

a future revision of the address architecture [RFC4291] and a future link-type-specific document, which will still be consistent with each other, could potentially allow for an interface identifier of length other than the value defined in the current documents. Thus, an implementation should not assume a particular constant. Rather, it should expect any lengths of interface identifiers.

In other words, this constant may be used to generate addresses or subnet prefix lengths, but should not be used to validate addresses or subnet prefix lengths generated by other software or other machines, as it might be valid for other software or other machines to use an interface identifier length different from this one.

Source

pub const FLOW_LABEL_BITS: u8 = 20u8

The length, in bits, of an IPv6 flow label, defined in RFC 6437 Section 2.

Trait Implementations§

Source§

impl Clone for Ipv6

Source§

fn clone(&self) -> Ipv6

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 Ipv6

Source§

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

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

impl Default for Ipv6

Source§

fn default() -> Ipv6

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

impl Hash for Ipv6

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 Ipv6

Source§

const UNSPECIFIED_ADDRESS: Ipv6Addr = _

The unspecified IPv6 address, defined in RFC 4291 Section 2.5.2.

Per RFC 4291:

The address 0:0:0:0:0:0:0:0 is called the unspecified address. It must never be assigned to any node. It indicates the absence of an address. One example of its use is in the Source Address field of any IPv6 packets sent by an initializing host before it has learned its own address.

The unspecified address must not be used as the destination address of IPv6 packets or in IPv6 Routing headers. An IPv6 packet with a source address of unspecified must never be forwarded by an IPv6 router.

Source§

const LOOPBACK_ADDRESS: SpecifiedAddr<Ipv6Addr> = _

The loopback IPv6 address, defined in RFC 4291 Section 2.5.3.

Per RFC 4291:

The unicast address 0:0:0:0:0:0:0:1 is called the loopback address. It may be used by a node to send an IPv6 packet to itself. It must not be assigned to any physical interface. It is treated as having Link-Local scope, and may be thought of as the Link-Local unicast address of a virtual interface (typically called the “loopback interface”) to an imaginary link that goes nowhere.

The loopback address must not be used as the source address in IPv6 packets that are sent outside of a single node. An IPv6 packet with a destination address of loopback must never be sent outside of a single node and must never be forwarded by an IPv6 router. A packet received on an interface with a destination address of loopback must be dropped.

Source§

const LOOPBACK_SUBNET: Subnet<Ipv6Addr> = _

The subnet of loopback IPv6 addresses, defined in RFC 4291 Section 2.4.

Note that the IPv6 loopback subnet is a /128, meaning that it contains only one address - the LOOPBACK_ADDRESS.

Source§

const MULTICAST_SUBNET: Subnet<Ipv6Addr> = _

The subnet of multicast IPv6 addresses, defined in RFC 4291 Section 2.7.

The subnet of link-local unicast addresses, defined in RFC 4291 Section 2.4.

Note that multicast addresses can also be link-local. However, there is no single subnet of link-local multicast addresses. For more details on link-local multicast addresses, see RFC 4291 Section 2.7.

The IPv6 minimum link MTU, defined in RFC 8200 Section 5.

Per RFC 8200:

IPv6 requires that every link in the Internet have an MTU of 1280 octets or greater. This is known as the IPv6 minimum link MTU. On any link that cannot convey a 1280-octet packet in one piece, link- specific fragmentation and reassembly must be provided at a layer below IPv6.

Source§

const VERSION: IpVersion = IpVersion::V6

The IP version. Read more
Source§

const VERSION_MARKER: IpVersionMarker<Self> = _

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

const NAME: &'static str = "IPv6"

“IPv4” or “IPv6”.
Source§

type Addr = Ipv6Addr

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 Ipv6

Source§

fn cmp(&self, other: &Ipv6) -> 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 Ipv6

Source§

fn eq(&self, other: &Ipv6) -> 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 Ipv6

Source§

fn partial_cmp(&self, other: &Ipv6) -> 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 Ipv6

Source§

impl Eq for Ipv6

Source§

impl StructuralPartialEq for Ipv6

Auto Trait Implementations§

§

impl Freeze for Ipv6

§

impl RefUnwindSafe for Ipv6

§

impl Send for Ipv6

§

impl Sync for Ipv6

§

impl Unpin for Ipv6

§

impl UnwindSafe for Ipv6

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.