#address #networking #interface #mac

mac_address

Cross-platform retrieval of a network interface MAC address

17 releases (stable)

1.1.6 Apr 16, 2024
1.1.5 May 25, 2023
1.1.4 Sep 20, 2022
1.1.3 Jan 24, 2022
0.8.0 Jul 21, 2018

#4 in #address

Download history 20353/week @ 2024-01-05 21063/week @ 2024-01-12 25110/week @ 2024-01-19 25785/week @ 2024-01-26 25195/week @ 2024-02-02 25644/week @ 2024-02-09 19182/week @ 2024-02-16 18886/week @ 2024-02-23 21053/week @ 2024-03-01 20938/week @ 2024-03-08 24332/week @ 2024-03-15 25960/week @ 2024-03-22 24625/week @ 2024-03-29 27226/week @ 2024-04-05 27041/week @ 2024-04-12 22662/week @ 2024-04-19

105,356 downloads per month
Used in 95 crates (58 directly)

MIT/Apache

22KB
498 lines

mac_address

crates.io Released API docs

mac_address provides a cross platform way to retrieve the MAC address of network hardware.

Supported platforms: Linux, Windows, MacOS, FreeBSD, OpenBSD

Example

use mac_address::get_mac_address;

fn main() {
    match get_mac_address() {
        Ok(Some(ma)) => {
            println!("MAC addr = {}", ma);
            println!("bytes = {:?}", ma.bytes());
        }
        Ok(None) => println!("No MAC address found."),
        Err(e) => println!("{:?}", e),
    }
}

License

mac_address is licensed under both MIT and Apache 2.0


lib.rs:

mac_address provides a cross platform way to retrieve the MAC address of network hardware. See the Wikipedia entry for more information.

Supported platforms: Linux, Windows, MacOS, FreeBSD

Dependencies

~0–730KB
~13K SLoC