add debug impl for MAC type

Signed-off-by: Erik Hollensbe <git@hollensbe.org>
This commit is contained in:
Erik Hollensbe 2022-04-21 18:04:08 -07:00
parent a453b25606
commit 187b78b367
No known key found for this signature in database
GPG key ID: 4BB0E241A863B389

View file

@ -6,6 +6,7 @@
* https://www.zerotier.com/
*/
use std::fmt::Debug;
use std::hash::{Hash, Hasher};
use std::num::NonZeroU64;
use std::str::FromStr;
@ -17,6 +18,12 @@ use crate::util::buffer::Buffer;
#[repr(transparent)]
pub struct MAC(NonZeroU64);
impl Debug for MAC {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str(&self.to_string())
}
}
impl MAC {
#[inline(always)]
pub fn from_u64(i: u64) -> Option<MAC> {