refactor: remove custom endian traits in favor of standard library

This commit is contained in:
Nils Andreas Svee committed 2026-02-20 22:40:37 +07:00
1 parent 3b5b124f8e
commit 90d7e75096
2 files changed
-33

No files matched your search

-32
View File
@@ -1,32 +0,0 @@
pub trait ToNativeEndian {
fn to_ne(self) -> Self;
}
/**
* A simple trait that adds a function to u32/u64 types
* to convert a number's endianness to native-endian
* based on the platform the code was built for
*/
impl ToNativeEndian for u32 {
#[cfg(target_endian = "big")]
fn to_ne(self) -> Self {
self.to_be()
}
#[cfg(target_endian = "little")]
fn to_ne(self) -> Self {
self.to_le()
}
}
impl ToNativeEndian for u64 {
#[cfg(target_endian = "big")]
fn to_ne(self) -> Self {
self.to_be()
}
#[cfg(target_endian = "little")]
fn to_ne(self) -> Self {
self.to_le()
}
}
-1
View File
@@ -2,7 +2,6 @@ extern crate core;
mod baseliner; mod baseliner;
mod config; mod config;
mod endian;
mod log; mod log;
mod netlink; mod netlink;
mod pinger; mod pinger;