Enum Ipv6MulticastScope

enum Ipv6MulticastScope

Scope of an IPv6 multicast address as defined in IETF RFC 7346 section 2, which updates IETF RFC 4291 section 2.7.

Stability Guarantees

Scopes 0 and F are currently reserved by IETF, and may be assigned in the future. For this reason, the enum variants for those two scopes are not currently nameable. You can still check for them in your code using as casts.

Examples

#![feature(ip)]

use std::net::Ipv6Addr;
use std::net::Ipv6MulticastScope::*;

// An IPv6 multicast address with global scope (`ff0e::`).
let address = Ipv6Addr::new(0xff0e, 0, 0, 0, 0, 0, 0, 0);

// Will print "Global scope".
match address.multicast_scope() {
    Some(InterfaceLocal) => println!("Interface-Local scope"),
    Some(LinkLocal) => println!("Link-Local scope"),
    Some(RealmLocal) => println!("Realm-Local scope"),
    Some(AdminLocal) => println!("Admin-Local scope"),
    Some(SiteLocal) => println!("Site-Local scope"),
    Some(OrganizationLocal) => println!("Organization-Local scope"),
    Some(Global) => println!("Global scope"),
    Some(s) => {
        let snum = s as u8;
        if matches!(0x0 | 0xF, snum) {
            println!("Reserved scope {snum:X}")
        } else {
            println!("Unassigned scope {snum:X}")
        }
    }
    None => println!("Not a multicast address!")
}

Variants

InterfaceLocal

Interface-Local scope.

LinkLocal

Link-Local scope.

RealmLocal

Realm-Local scope.

AdminLocal

Admin-Local scope.

SiteLocal

Site-Local scope.

Unassigned6

Scope 6. Unassigned, available for administrators to define additional multicast regions.

Unassigned7

Scope 7. Unassigned, available for administrators to define additional multicast regions.

OrganizationLocal

Organization-Local scope.

Unassigned9

Scope 9. Unassigned, available for administrators to define additional multicast regions.

UnassignedA

Scope A. Unassigned, available for administrators to define additional multicast regions.

UnassignedB

Scope B. Unassigned, available for administrators to define additional multicast regions.

UnassignedC

Scope C. Unassigned, available for administrators to define additional multicast regions.

UnassignedD

Scope D. Unassigned, available for administrators to define additional multicast regions.

Global

Global scope.

Implementations

impl Clone for Ipv6MulticastScope

fn clone(self: &Self) -> Ipv6MulticastScope

impl Copy for Ipv6MulticastScope

impl Debug for Ipv6MulticastScope

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

impl Eq for Ipv6MulticastScope

impl Freeze for Ipv6MulticastScope

impl Hash for Ipv6MulticastScope

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

impl Ord for Ipv6MulticastScope

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

impl PartialEq for Ipv6MulticastScope

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

impl PartialOrd for Ipv6MulticastScope

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

impl RefUnwindSafe for Ipv6MulticastScope

impl Send for Ipv6MulticastScope

impl StructuralPartialEq for Ipv6MulticastScope

impl Sync for Ipv6MulticastScope

impl Unpin for Ipv6MulticastScope

impl UnsafeUnpin for Ipv6MulticastScope

impl UnwindSafe for Ipv6MulticastScope

impl<T> Any for Ipv6MulticastScope

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for Ipv6MulticastScope

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for Ipv6MulticastScope

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

impl<T> CloneToUninit for Ipv6MulticastScope

unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)

impl<T> From for Ipv6MulticastScope

fn from(t: T) -> T

Returns the argument unchanged.

impl<T, U> Into for Ipv6MulticastScope

fn into(self: Self) -> U

Calls U::from(self).

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

impl<T, U> TryFrom for Ipv6MulticastScope

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

impl<T, U> TryInto for Ipv6MulticastScope

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