1 //! This crate provides types for a [MAC address] identifiers,
2 //! both in IEEE *EUI-48* and *EUI-64* formats.
3 //!
4 //! It is like a `std::net::SocketAddr` enum
5 //! with `std::net::SocketAddrV4` and `std::net::SocketAddrV6` members,
6 //! but for MAC addresses instead.
7 //!
8 //! Obviously, MAC address can be represented as a `[u8; 6]` or `[u8; 8]`,
9 //! but it is error-prone and inconvenient, so here they are —
10 //! [MacAddr6] and [MacAddr8] structs with helpful methods and
11 //! standard Rust traits implementations to make them first-class
12 //! Rust objects.
13 //!
14 //! ## Serde support
15 //!
16 //! [Serde] support can be enabled with a `"serde_std"` feature
17 //! (disabled by default) if used in `std`-enabled builds.
18 //!
19 //! This feature is called like this because of [this Cargo bug].\
20 //! `"serde"` feature is exists also, but it is intended to be used
21 //! in the `no_std` builds.
22 //!
23 //! ## No-std support
24 //!
25 //! This crate can be used in a `no_std` builds with
26 //! disabled `"std"` feature (enabled by default).
27 //!
28 //! Enabled `"serde"` feature will add support for `no_std`
29 //! serde serialization and deserialization.
30 //!
31 //! [Serde]: https://serde.rs
32 //! [MAC address]: https://en.wikipedia.org/wiki/MAC_address
33 //! [this Cargo bug]: https://github.com/rust-lang/cargo/issues/3494
34 //! [MacAddr6]: struct.MacAddr6.html
35 //! [MacAddr8]: struct.MacAddr8.html
36 #![cfg_attr(not(feature = "std"), no_std)]
37 #![doc(html_root_url = "https://docs.rs/macaddr/1.0.0")]
38 #![forbid(unsafe_code)]
39 
40 mod addr;
41 mod addr6;
42 mod addr8;
43 mod parser;
44 
45 pub use self::addr::MacAddr;
46 pub use self::addr6::MacAddr6;
47 pub use self::addr8::MacAddr8;
48 pub use self::parser::ParseError;
49