#mac-address #network-interface #networking

mac_address

Cross-platform retrieval of a network interface MAC address

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

#77 in Network programming

Download history 33389/week @ 2024-12-27 33995/week @ 2025-01-03 32386/week @ 2025-01-10 36309/week @ 2025-01-17 38208/week @ 2025-01-24 46165/week @ 2025-01-31 51932/week @ 2025-02-07 52527/week @ 2025-02-14 51340/week @ 2025-02-21 56939/week @ 2025-02-28 56737/week @ 2025-03-07 59058/week @ 2025-03-14 52840/week @ 2025-03-21 54172/week @ 2025-03-28 59138/week @ 2025-04-04 51701/week @ 2025-04-11

230,544 downloads per month
Used in 191 crates (73 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–700KB
~12K SLoC