net_types::ip

Enum Ipv6Scope

Source
pub enum Ipv6Scope {
    InterfaceLocal,
    LinkLocal,
    AdminLocal,
    SiteLocal,
    OrganizationLocal,
    Global,
    Reserved(Ipv6ReservedScope),
    Unassigned(Ipv6UnassignedScope),
}
Expand description

The list of IPv6 scopes.

These scopes are defined by RFC 4291 Section 2.7.

Variants§

§

InterfaceLocal

The interface-local scope.

§

LinkLocal

The link-local scope.

§

AdminLocal

The admin-local scope.

§

SiteLocal

The (deprecated) site-local scope.

The site-local scope was deprecated in RFC 3879. While this scope is returned for both site-local unicast and site-local multicast addresses, RFC 3879 says the following about site-local unicast addresses in particular (“this prefix” refers to the site-local unicast subnet):

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.

§

OrganizationLocal

The organization-local scope.

§

Global

The global scope.

§

Reserved(Ipv6ReservedScope)

Scopes which are reserved for future use by RFC 4291 Section 2.7.

§

Unassigned(Ipv6UnassignedScope)

Scopes which are available for local definition by administrators.

Implementations§

Source§

impl Ipv6Scope

Source

pub const MULTICAST_SCOPE_ID_INTERFACE_LOCAL: u8 = 1u8

The multicast scope ID of an interface-local address, defined in RFC 4291 Section 2.7.

The multicast scope ID of a link-local address, defined in RFC 4291 Section 2.7.

Source

pub const MULTICAST_SCOPE_ID_ADMIN_LOCAL: u8 = 4u8

The multicast scope ID of an admin-local address, defined in RFC 4291 Section 2.7.

Source

pub const MULTICAST_SCOPE_ID_SITE_LOCAL: u8 = 5u8

The multicast scope ID of a (deprecated) site-local address, defined in RFC 4291 Section 2.7.

Note that site-local addresses are deprecated.

Source

pub const MULTICAST_SCOPE_ID_ORG_LOCAL: u8 = 8u8

The multicast scope ID of an organization-local address, defined in RFC 4291 Section 2.7.

Source

pub const MULTICAST_SCOPE_ID_GLOBAL: u8 = 14u8

The multicast scope ID of global address, defined in RFC 4291 Section 2.7.

Source

pub fn multicast_scope_id(&self) -> u8

The ID used to indicate this scope in a multicast IPv6 address.

Per RFC 4291 Section 2.7, the bits of a multicast IPv6 address are laid out as follows:

|   8    |  4 |  4 |                  112 bits                   |
+------ -+----+----+---------------------------------------------+
|11111111|flgs|scop|                  group ID                   |
+--------+----+----+---------------------------------------------+

The 4-bit scop field encodes the scope of the address. multicast_scope_id returns the numerical value used to encode this scope in the scop field of a multicast address.

Trait Implementations§

Source§

impl Clone for Ipv6Scope

Source§

fn clone(&self) -> Ipv6Scope

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 Ipv6Scope

Source§

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

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

impl PartialEq for Ipv6Scope

Source§

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

Source§

fn can_have_zone(&self) -> bool

Can addresses in this scope have an associated zone?
Source§

impl Copy for Ipv6Scope

Source§

impl Eq for Ipv6Scope

Source§

impl StructuralPartialEq for Ipv6Scope

Auto Trait Implementations§

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.