Skip to main content

twine_codec/radio/
eui.rs

1// Copyright (c) 2025 Jake Swensen
2// SPDX-License-Identifier: MPL-2.0
3//
4// This Source Code Form is subject to the terms of the Mozilla Public
5// License, v. 2.0. If a copy of the MPL was not distributed with this
6// file, You can obtain one at http://mozilla.org/MPL/2.0/.
7
8const EUI64_SIZE: usize = 8;
9
10pub struct Eui64([u8; EUI64_SIZE]);
11
12impl From<Eui64> for u64 {
13    fn from(value: Eui64) -> Self {
14        u64::from_be_bytes(value.0)
15    }
16}
17
18impl From<u64> for Eui64 {
19    fn from(extended_address: u64) -> Self {
20        Self(extended_address.to_be_bytes())
21    }
22}