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!")
}
Run

Variants (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

source§

fn clone(&self) -> Ipv6MulticastScope

返回值的副本。 Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

source 执行复制分配。 Read more
source§

impl Debug for Ipv6MulticastScope

source§

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

使用给定的格式化程序格式化该值。 Read more
source§

impl Hash for Ipv6MulticastScope

source§

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

将该值输入给定的 HasherRead more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)where H: Hasher, Self: Sized,

将这种类型的切片送入给定的 Hasher 中。 Read more
source§

impl PartialEq<Ipv6MulticastScope> for Ipv6MulticastScope

source§

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

此方法测试 selfother 值是否相等,并由 == 使用。
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

此方法测试 !=。 默认实现几乎总是足够的,并且不应在没有充分理由的情况下被覆盖。
source§

impl Copy for Ipv6MulticastScope

source§

impl Eq for Ipv6MulticastScope

source§

impl StructuralEq for Ipv6MulticastScope

source§

impl StructuralPartialEq for Ipv6MulticastScope

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

获取 selfTypeIdRead more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

从拥有的值中一成不变地借用。 Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

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

从拥有的值中借用。 Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

返回未更改的参数。

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

调用 U::from(self)

也就是说,这种转换是 From<T> for U 实现选择执行的任何操作。

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

获得所有权后的结果类型。
source§

fn to_owned(&self) -> T

从借用的数据创建拥有的数据,通常是通过克隆。 Read more
source§

fn clone_into(&self, target: &mut T)

使用借来的数据来替换拥有的数据,通常是通过克隆。 Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

发生转换错误时返回的类型。
source§

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

执行转换。
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

发生转换错误时返回的类型。
source§

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

执行转换。