Enum Ipv6MulticastScope

pub 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

Reserved0 = 0x0

Reserved by IETF.

InterfaceLocal = 0x1

Interface-Local scope.

LinkLocal = 0x2

Link-Local scope.

RealmLocal = 0x3

Realm-Local scope.

AdminLocal = 0x4

Admin-Local scope.

SiteLocal = 0x5

Site-Local scope.

Unassigned6 = 0x6

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

Unassigned7 = 0x7

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

OrganizationLocal = 0x8

Organization-Local scope.

Unassigned9 = 0x9

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

UnassignedA = 0xA

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

UnassignedB = 0xB

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

UnassignedC = 0xC

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

UnassignedD = 0xD

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

Global = 0xE

Global scope.

ReservedF = 0xF

Reserved by IETF.

Trait Implementations

impl Clone for Ipv6MulticastScope

fn clone(&self) -> Ipv6MulticastScope

impl Copy for Ipv6MulticastScope

impl Debug for Ipv6MulticastScope

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

impl Eq for Ipv6MulticastScope

fn assert_fields_are_eq(&self)

impl Hash for Ipv6MulticastScope

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

impl Ord for Ipv6MulticastScope

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

impl PartialEq for Ipv6MulticastScope

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

impl PartialOrd for Ipv6MulticastScope

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

impl StructuralPartialEq for Ipv6MulticastScope

impl TrivialClone for Ipv6MulticastScope

Auto Trait Implementations

impl Freeze for Ipv6MulticastScope

impl RefUnwindSafe for Ipv6MulticastScope

impl Send for Ipv6MulticastScope

impl Sync for Ipv6MulticastScope

impl Unpin for Ipv6MulticastScope

impl UnsafeUnpin for Ipv6MulticastScope

impl UnwindSafe for Ipv6MulticastScope

Blanket Implementations

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

fn type_id(&self) -> TypeId

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

fn borrow(&self) -> &T

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

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

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

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

impl<T> From<T> for Ipv6MulticastScope

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> Printable for Ipv6MulticastScope where T: Copy + Debug,

impl<T> SizeHint for Ipv6MulticastScope where T: ?Sized,

fn lower_bound(&self) -> usize
fn upper_bound(&self) -> Option<usize>

impl<T> SizedTypeProperties for Ipv6MulticastScope

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

fn into(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<U> for Ipv6MulticastScope where U: Into<T>,

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

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

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