• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# macaddr
2
3> MAC address types for Rust
4
5[![Latest Version](https://img.shields.io/crates/v/macaddr.svg)](https://crates.io/crates/macaddr)
6[![Latest Version](https://docs.rs/macaddr/badge.svg)](https://docs.rs/macaddr)
7[![Build Status](https://github.com/svartalf/rust-macaddr/workflows/Continuous%20integration/badge.svg)](https://github.com/svartalf/rust-macaddr/actions)
8[![Coverage Status](https://coveralls.io/repos/github/svartalf/rust-macaddr/badge.svg?branch=master)](https://coveralls.io/github/svartalf/rust-macaddr?branch=master)
9![Minimum rustc version](https://img.shields.io/badge/rustc-1.31+-green.svg)
10![Apache 2.0 OR MIT licensed](https://img.shields.io/badge/license-Apache2.0%2FMIT-blue.svg)
11![unsafe forbidden](https://img.shields.io/badge/unsafe-forbidden-success.svg)
12
13This crate provides types for a [MAC address](https://en.wikipedia.org/wiki/MAC_address)
14identifiers, both in IEEE *EUI-48* and *EUI-64* formats.
15
16It is like a [`std::net::SocketAddr`](https://doc.rust-lang.org/std/net/enum.SocketAddr.html) enum with a
17[`std::net::SocketAddrV4`](https://doc.rust-lang.org/std/net/struct.SocketAddrV4.html) and
18[`std::net::SocketAddrV6`](https://doc.rust-lang.org/std/net/struct.SocketAddrV6.html) members,
19but for MAC addresses instead.
20
21Obviously, MAC address can be represented as a `[u8; 6]` or `[u8; 8]`,
22but it is error-prone and inconvenient, so here they are —
23[MacAddr6](https://docs.rs/macaddr/latest/macaddr/struct.MacAddr6.html) and
24[MacAddr8](https://docs.rs/macaddr/latest/macaddr/struct.MacAddr8.html)
25structs with helpful methods and standard Rust traits implementations,
26intended to be the first-class Rust objects.
27
28And it is `serde`- and `no_std`-friendly also!
29
30## Installation
31
32Add this to your `Cargo.toml`
33
34```toml
35[dependencies]
36macaddr = "1.0"
37```
38
39## Usage
40
41Check out the [documentation](https://docs.rs/macaddr) for each type
42available, all of them have a plenty of examples.
43
44## License
45
46Licensed under either of [Apache License 2.0](https://github.com/svartalf/rust-macaddr/blob/master/LICENSE-APACHE)
47or [MIT license](https://github.com/svartalf/rust-macaddr/blob/master/LICENSE-MIT) at your option.
48
49Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you,
50as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
51
52