Commit 36bf05c2 authored by Nawasan Wisitsingkhon's avatar Nawasan Wisitsingkhon

match fields marshal

parent b2b05232
use byteorder::WriteBytesExt;
pub struct MacAddr { pub struct MacAddr {
mac: [u8; 6], mac: [u8; 6],
} }
...@@ -8,6 +10,14 @@ impl MacAddr { ...@@ -8,6 +10,14 @@ impl MacAddr {
} }
} }
impl MacAddr {
pub fn marshal(&self, bytes: &mut Vec<u8>) {
for m in self.mac.iter() {
bytes.write_u8(*m);
}
}
}
impl From<MacAddr> for u64 { impl From<MacAddr> for u64 {
fn from(value: MacAddr) -> Self { fn from(value: MacAddr) -> Self {
let mut byte: u64 = 0; let mut byte: u64 = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment