pub struct RtnlAddressClient { /* private fields */ }Implementations§
Source§impl RtnlAddressClient
impl RtnlAddressClient
Sourcepub fn ipv4_addrs_get(&self, if_id: Option<u32>) -> Result<Vec<Ipv4Addr>>
pub fn ipv4_addrs_get(&self, if_id: Option<u32>) -> Result<Vec<Ipv4Addr>>
Examples found in repository?
examples/if-summary.rs (line 18)
4fn main() -> std::io::Result<()> {
5 let client = RtnlClient::new();
6 let link_client = client.link();
7 let addr_client = client.address();
8 let ifs = link_client.interface_list()?;
9 for interface in ifs {
10 println!("Interface: {} ({})", &interface.if_name, interface.if_id);
11 let if_id = interface.if_id;
12 let mac = link_client.mac_addr_get(if_id)?;
13 if let Some(mac) = mac {
14 println!(" MAC address: {}", mac);
15 } else {
16 println!(" No MAC address");
17 }
18 let v4addrs = addr_client.ipv4_addrs_get(Some(if_id))?;
19 println!(" IPv4 addresses:");
20 for addr in v4addrs {
21 println!(" {}", addr);
22 }
23 let v6addrs = addr_client.ipv6_addrs_get(Some(if_id))?;
24 println!(" IPv6 addresses:");
25 for addr in v6addrs {
26 println!(" {}", addr);
27 }
28 println!("");
29 }
30 Ok(())
31}Sourcepub fn ipv6_addrs_get(&self, if_id: Option<u32>) -> Result<Vec<Ipv6Addr>>
pub fn ipv6_addrs_get(&self, if_id: Option<u32>) -> Result<Vec<Ipv6Addr>>
Examples found in repository?
examples/if-summary.rs (line 23)
4fn main() -> std::io::Result<()> {
5 let client = RtnlClient::new();
6 let link_client = client.link();
7 let addr_client = client.address();
8 let ifs = link_client.interface_list()?;
9 for interface in ifs {
10 println!("Interface: {} ({})", &interface.if_name, interface.if_id);
11 let if_id = interface.if_id;
12 let mac = link_client.mac_addr_get(if_id)?;
13 if let Some(mac) = mac {
14 println!(" MAC address: {}", mac);
15 } else {
16 println!(" No MAC address");
17 }
18 let v4addrs = addr_client.ipv4_addrs_get(Some(if_id))?;
19 println!(" IPv4 addresses:");
20 for addr in v4addrs {
21 println!(" {}", addr);
22 }
23 let v6addrs = addr_client.ipv6_addrs_get(Some(if_id))?;
24 println!(" IPv6 addresses:");
25 for addr in v6addrs {
26 println!(" {}", addr);
27 }
28 println!("");
29 }
30 Ok(())
31}Trait Implementations§
Source§impl Clone for RtnlAddressClient
impl Clone for RtnlAddressClient
Source§fn clone(&self) -> RtnlAddressClient
fn clone(&self) -> RtnlAddressClient
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for RtnlAddressClient
impl Debug for RtnlAddressClient
Source§impl Hash for RtnlAddressClient
impl Hash for RtnlAddressClient
Source§impl PartialEq for RtnlAddressClient
impl PartialEq for RtnlAddressClient
impl Eq for RtnlAddressClient
impl StructuralPartialEq for RtnlAddressClient
Auto Trait Implementations§
impl Freeze for RtnlAddressClient
impl RefUnwindSafe for RtnlAddressClient
impl Send for RtnlAddressClient
impl Sync for RtnlAddressClient
impl Unpin for RtnlAddressClient
impl UnwindSafe for RtnlAddressClient
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