当前位置: 首页>>代码示例 >>用法及示例精选 >>正文


Rust SocketAddrV6.set_scope_id用法及代码示例


本文简要介绍rust语言中 std::net::SocketAddrV6.set_scope_id 的用法。

用法

pub fn set_scope_id(&mut self, new_scope_id: u32)

更改与此套接字地址关联的范围 ID。

有关详细信息,请参阅 SocketAddrV6::scope_id 的文档。

例子

use std::net::{SocketAddrV6, Ipv6Addr};

let mut socket = SocketAddrV6::new(Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 1), 8080, 0, 78);
socket.set_scope_id(42);
assert_eq!(socket.scope_id(), 42);

相关用法


注:本文由纯净天空筛选整理自rust-lang.org大神的英文原创作品 std::net::SocketAddrV6.set_scope_id。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。