Enum std::net::Ipv6MulticastScope
source · 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 moresource§impl Debug for Ipv6MulticastScope
impl Debug for Ipv6MulticastScope
source§impl Hash for Ipv6MulticastScope
impl Hash for Ipv6MulticastScope
impl Copy for Ipv6MulticastScope
impl Eq for Ipv6MulticastScope
impl StructuralEq for Ipv6MulticastScope
impl StructuralPartialEq for Ipv6MulticastScope
Auto Trait Implementations§
impl RefUnwindSafe for Ipv6MulticastScope
impl Send for Ipv6MulticastScope
impl Sync for Ipv6MulticastScope
impl Unpin for Ipv6MulticastScope
impl UnwindSafe for Ipv6MulticastScope
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
从拥有的值中借用。 Read more