pub struct NetworkInterface { /* private fields */ }
Expand description
网络接口
Implementations§
Source§impl NetworkInterface
impl NetworkInterface
pub fn new( if_index: u32, name: &String, mac_addr: &mac_addr_t, ipnet: IpNetwork, mtu: u16, ) -> Self
pub fn get_sys_interfaces() -> Option<Vec<NetworkInterface>>
pub fn get_interface_by_name( ifname: &String, ) -> Result<NetworkInterface, RESULT>
Sourcepub fn get_ip_list(&self) -> Vec<IpNetwork>
pub fn get_ip_list(&self) -> Vec<IpNetwork>
获取Interface的IP列表
Sourcepub fn get_first_ip(&self) -> Option<IpNetwork>
pub fn get_first_ip(&self) -> Option<IpNetwork>
获取接口的第一个IP地址
pub fn get_mtu(&self) -> u16
pub fn get_mac_addr(&self) -> mac_addr_t
pub fn get_if_index(&self) -> u32
pub fn get_if_name(&self) -> String
pub fn set_ip_addr(&mut self, ip: &IpAddr, mask_len: u8) -> RESULT
pub fn set_mac_addr(&mut self, new_mac: &mac_addr_t) -> RESULT
pub fn to_string(&self) -> String
Trait Implementations§
Source§impl Clone for NetworkInterface
impl Clone for NetworkInterface
Source§fn clone(&self) -> NetworkInterface
fn clone(&self) -> NetworkInterface
Returns a duplicate of the value. Read more
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for NetworkInterface
impl RefUnwindSafe for NetworkInterface
impl Send for NetworkInterface
impl Sync for NetworkInterface
impl Unpin for NetworkInterface
impl UnwindSafe for NetworkInterface
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
Mutably borrows from an owned value. Read more