Enum core::net::Ipv6MulticastScope
source · #[non_exhaustive]pub enum Ipv6MulticastScope {
InterfaceLocal,
LinkLocal,
RealmLocal,
AdminLocal,
SiteLocal,
OrganizationLocal,
Global,
}
🔬This is a nightly-only experimental API. (
ip
#27709)Expand description
IETF RFC 7346 第 2 节 中定义的 IPv6 多播地址 的范围。
稳定性保证
并非多播作用域的所有可能值都已分配。
未来的 RFC 可能会引入新的作用域,它将作为变体添加到此枚举中;
因此,枚举被标记为 #[non_exhaustive]
。
Examples
#![feature(ip)]
use std::net::Ipv6Addr;
use std::net::Ipv6MulticastScope::*;
// 具有全局作用域 (`ff0e::`) 的 IPv6 多播地址。
let address = Ipv6Addr::new(0xff0e, 0, 0, 0, 0, 0, 0, 0);
// 将打印 "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(_) => println!("Unknown scope"),
None => println!("Not a multicast address!")
}
RunVariants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
InterfaceLocal
🔬This is a nightly-only experimental API. (
ip
#27709)Interface-Local 作用域。
LinkLocal
🔬This is a nightly-only experimental API. (
ip
#27709)Link-Local 作用域。
RealmLocal
🔬This is a nightly-only experimental API. (
ip
#27709)Realm-Local 作用域。
AdminLocal
🔬This is a nightly-only experimental API. (
ip
#27709)Admin-Local 作用域。
SiteLocal
🔬This is a nightly-only experimental API. (
ip
#27709)Site-Local 作用域。
OrganizationLocal
🔬This is a nightly-only experimental API. (
ip
#27709)Organization-Local 作用域。
Global
🔬This is a nightly-only experimental API. (
ip
#27709)Global 作用域。
Trait Implementations§
source§impl Clone for Ipv6MulticastScope
impl Clone for Ipv6MulticastScope
source§fn clone(&self) -> Ipv6MulticastScope
fn clone(&self) -> Ipv6MulticastScope
返回值的副本。 Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
从
source
执行复制分配。 Read more