19 releases (stable)

1.1.8 Feb 10, 2025
1.1.7 May 22, 2024
1.1.6 Apr 16, 2024
1.1.5 May 25, 2023
0.8.0 Jul 21, 2018

#86 in Network programming

Download history 54267/week @ 2025-02-24 55004/week @ 2025-03-03 55898/week @ 2025-03-10 59211/week @ 2025-03-17 53015/week @ 2025-03-24 58058/week @ 2025-03-31 57042/week @ 2025-04-07 44137/week @ 2025-04-14 42281/week @ 2025-04-21 42976/week @ 2025-04-28 50834/week @ 2025-05-05 51501/week @ 2025-05-12 46165/week @ 2025-05-19 48027/week @ 2025-05-26 55999/week @ 2025-06-02 49160/week @ 2025-06-09

203,009 downloads per month
Used in 203 crates (77 directly)

MIT/Apache

25KB
540 lines

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, NetBSD


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, illumos

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

Dependencies

~0–740KB
~13K SLoC