chore: Reorganize file tree for easier onboarding. Rust project now at the root for simple git clone && cargo run

This commit is contained in:
2025-02-12 15:32:59 -05:00
parent 83b4efd625
commit 96bbef8195
144 changed files with 0 additions and 32 deletions

6
harmony_types/Cargo.toml Normal file
View File

@@ -0,0 +1,6 @@
[package]
name = "harmony_types"
edition = "2024"
version.workspace = true
readme.workspace = true
license.workspace = true

26
harmony_types/src/lib.rs Normal file
View File

@@ -0,0 +1,26 @@
pub mod net {
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
pub struct MacAddress(pub [u8; 6]);
impl MacAddress {
#[cfg(test)]
pub fn dummy() -> Self {
Self([0, 0, 0, 0, 0, 0])
}
}
impl From<&MacAddress> for String {
fn from(value: &MacAddress) -> Self {
format!(
"{:02x}:{:02x}:{:02x}:{:02x}:{:02x}:{:02x}",
value.0[0], value.0[1], value.0[2], value.0[3], value.0[4], value.0[5]
)
}
}
impl std::fmt::Display for MacAddress {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_fmt(format_args!("MacAddress {}", String::from(self)))
}
}
}