pub enum Ipv6MulticastScope {
Show 14 variants
InterfaceLocal = 1,
LinkLocal = 2,
RealmLocal = 3,
AdminLocal = 4,
SiteLocal = 5,
Unassigned6 = 6,
Unassigned7 = 7,
OrganizationLocal = 8,
Unassigned9 = 9,
UnassignedA = 10,
UnassignedB = 11,
UnassignedC = 12,
UnassignedD = 13,
Global = 14,
// some variants omitted
}ip #27709)Expand description
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 = 1
ip #27709)Interface-Local scope.
LinkLocal = 2
ip #27709)Link-Local scope.
RealmLocal = 3
ip #27709)Realm-Local scope.
AdminLocal = 4
ip #27709)Admin-Local scope.
SiteLocal = 5
ip #27709)Site-Local scope.
Unassigned6 = 6
ip #27709)Scope 6. Unassigned, available for administrators to define additional multicast regions.
Unassigned7 = 7
ip #27709)Scope 7. Unassigned, available for administrators to define additional multicast regions.
OrganizationLocal = 8
ip #27709)Organization-Local scope.
Unassigned9 = 9
ip #27709)Scope 9. Unassigned, available for administrators to define additional multicast regions.
UnassignedA = 10
ip #27709)Scope A. Unassigned, available for administrators to define additional multicast regions.
UnassignedB = 11
ip #27709)Scope B. Unassigned, available for administrators to define additional multicast regions.
UnassignedC = 12
ip #27709)Scope C. Unassigned, available for administrators to define additional multicast regions.
UnassignedD = 13
ip #27709)Scope D. Unassigned, available for administrators to define additional multicast regions.
Global = 14
ip #27709)Global scope.
Trait Implementations§
Source§impl Clone for Ipv6MulticastScope
impl Clone for Ipv6MulticastScope
Source§fn clone(&self) -> Ipv6MulticastScope
fn clone(&self) -> Ipv6MulticastScope
1.0.0 · Source§fn clone_from(&mut self, source: &Self)where
Self:,
fn clone_from(&mut self, source: &Self)where
Self:,
source. Read more