pub struct Net { /* private fields */ }
Implementations§
Source§impl Net
impl Net
Sourcepub fn statistics(&self) -> NetStatistics<'_>
pub fn statistics(&self) -> NetStatistics<'_>
Examples found in repository?
examples/net.rs (line 12)
4fn main() -> io::Result<()> {
5 for dev in Net::iter() {
6 let dev = dev?;
7
8 println!("{}: {}", dev.id(), dev.address().unwrap());
9 println!(" MTU: {}", dev.mtu().unwrap());
10 println!(" Duplex: {:?}", dev.duplex());
11
12 let statistics = dev.statistics();
13 println!(
14 " RX: {} MiB",
15 statistics.rx_bytes().unwrap() / (1024 * 1024)
16 );
17 println!(
18 " TX: {} MiB",
19 statistics.tx_bytes().unwrap() / (1024 * 1024)
20 );
21 }
22
23 Ok(())
24}
pub fn addr_assign_type(&self) -> Result<u8>
pub fn addr_len(&self) -> Result<u16>
Sourcepub fn address(&self) -> Result<String>
pub fn address(&self) -> Result<String>
Examples found in repository?
examples/net.rs (line 8)
4fn main() -> io::Result<()> {
5 for dev in Net::iter() {
6 let dev = dev?;
7
8 println!("{}: {}", dev.id(), dev.address().unwrap());
9 println!(" MTU: {}", dev.mtu().unwrap());
10 println!(" Duplex: {:?}", dev.duplex());
11
12 let statistics = dev.statistics();
13 println!(
14 " RX: {} MiB",
15 statistics.rx_bytes().unwrap() / (1024 * 1024)
16 );
17 println!(
18 " TX: {} MiB",
19 statistics.tx_bytes().unwrap() / (1024 * 1024)
20 );
21 }
22
23 Ok(())
24}
pub fn broadcast(&self) -> Result<String>
pub fn carrier(&self) -> Result<u16>
pub fn carrier_changes(&self) -> Result<u16>
pub fn carrier_down_count(&self) -> Result<u16>
pub fn carrier_up_count(&self) -> Result<u16>
pub fn dev_id(&self) -> Result<String>
pub fn dev_port(&self) -> Result<u16>
pub fn dormant(&self) -> Result<u8>
Sourcepub fn duplex(&self) -> Result<String>
pub fn duplex(&self) -> Result<String>
Examples found in repository?
examples/net.rs (line 10)
4fn main() -> io::Result<()> {
5 for dev in Net::iter() {
6 let dev = dev?;
7
8 println!("{}: {}", dev.id(), dev.address().unwrap());
9 println!(" MTU: {}", dev.mtu().unwrap());
10 println!(" Duplex: {:?}", dev.duplex());
11
12 let statistics = dev.statistics();
13 println!(
14 " RX: {} MiB",
15 statistics.rx_bytes().unwrap() / (1024 * 1024)
16 );
17 println!(
18 " TX: {} MiB",
19 statistics.tx_bytes().unwrap() / (1024 * 1024)
20 );
21 }
22
23 Ok(())
24}
Sourcepub fn mtu(&self) -> Result<u32>
pub fn mtu(&self) -> Result<u32>
Examples found in repository?
examples/net.rs (line 9)
4fn main() -> io::Result<()> {
5 for dev in Net::iter() {
6 let dev = dev?;
7
8 println!("{}: {}", dev.id(), dev.address().unwrap());
9 println!(" MTU: {}", dev.mtu().unwrap());
10 println!(" Duplex: {:?}", dev.duplex());
11
12 let statistics = dev.statistics();
13 println!(
14 " RX: {} MiB",
15 statistics.rx_bytes().unwrap() / (1024 * 1024)
16 );
17 println!(
18 " TX: {} MiB",
19 statistics.tx_bytes().unwrap() / (1024 * 1024)
20 );
21 }
22
23 Ok(())
24}
pub fn operstate(&self) -> Result<String>
pub fn speed(&self) -> Result<u32>
pub fn tx_queue_len(&self) -> Result<u32>
Trait Implementations§
Source§impl SysClass for Net
impl SysClass for Net
Source§fn class() -> &'static str
fn class() -> &'static str
Return the class of the sys object, the name of a folder in `/sys/${base}``
Source§unsafe fn from_path_unchecked(path: PathBuf) -> Self
unsafe fn from_path_unchecked(path: PathBuf) -> Self
Create a sys object from an absolute path without checking path for validity
Source§fn dir() -> PathBuf
fn dir() -> PathBuf
Return the path to the sys objects, the full path of a folder in /sys/class
Source§fn from_path(path: &Path) -> Result<Self>
fn from_path(path: &Path) -> Result<Self>
Create a sys object from a path, checking it for validity
Source§fn iter() -> Box<dyn Iterator<Item = Result<Self>>>where
Self: 'static,
fn iter() -> Box<dyn Iterator<Item = Result<Self>>>where
Self: 'static,
Retrieve all of the object instances of a sys class, with a boxed iterator
Source§fn read_file<P: AsRef<Path>>(&self, name: P) -> Result<String>
fn read_file<P: AsRef<Path>>(&self, name: P) -> Result<String>
Read a file underneath the sys object
Source§fn parse_file<F: FromStr, P: AsRef<Path>>(&self, name: P) -> Result<F>
fn parse_file<F: FromStr, P: AsRef<Path>>(&self, name: P) -> Result<F>
Parse a number from a file underneath the sys object
Auto Trait Implementations§
impl Freeze for Net
impl RefUnwindSafe for Net
impl Send for Net
impl Sync for Net
impl Unpin for Net
impl UnwindSafe for Net
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