Crate hardware_address

Source
Expand description

Hardware Address

IEEE 802 MAC-48, EUI-48, EUI-64, or a 20-octet IP over InfiniBand link-layer addresses and more.

github LoC Build codecov

docs.rs crates.io crates.io license

§Installation

[dependencies]
hardware-address = "0.1"

§Pedigree

This code is inspired and modified based on Golang’s mac implementation.

§License

hardware-address is under the terms of both the MIT license and the Apache License (Version 2.0).

See LICENSE-APACHE, LICENSE-MIT for details.

Copyright (c) 2025 Al Liu.

Macros§

addr_ty
A macro for defining address types.

Structs§

Eui64Addr
Represents a physical EUI-64 format address.
InfiniBandAddr
Represents a physical 20-octet InfiniBand format address.
MacAddr
Represents a physical hardware address (MAC address).

Enums§

ParseError
ParseError represents an error that occurred while parsing hex address.

Functions§

parse
Parses s as an IEEE 802 MAC-48, EUI-48, EUI-64, or a 20-octet IP over InfiniBand link-layer address and etc using one of the following formats:
xtoi
Converts a hexadecimal slice to an integer. Returns a tuple containing:
xtoi2
Converts the next two hex digits of s into a byte. If s is longer than 2 bytes then the third byte must match e.

Type Aliases§

ParseEui64AddrError
Represents an error that occurred while parsing Eui64Addr.
ParseInfiniBandAddrError
Represents an error that occurred while parsing InfiniBandAddr.
ParseMacAddrError
Represents an error that occurred while parsing MacAddr.