feat: get rid of unnecessary method

This commit is contained in:
leonhard committed 2026-10-23 13:04:02 +02:00
1 parent b40a156b13
commit 3ef19612d7
1 file changed
+7 -15
+7 -15
View File
@@ -9,32 +9,24 @@ pub struct BaseHeader {
os: Os,
}
impl BaseHeader {
const SIZE: usize = 10;
fn to_bytes(self) -> [u8; Self::SIZE] {
let mtime: [u8; 4] = self.last_modified.into();
impl From<BaseHeader> for [u8; 10] {
fn from(header: BaseHeader) -> Self {
let mtime: [u8; 4] = header.last_modified.into();
[
ID1,
ID2,
self.compression_method.into(),
self.flags.0,
header.compression_method.into(),
header.flags.0,
mtime[0],
mtime[1],
mtime[2],
mtime[3],
self.extra_flags.0,
self.os.into(),
header.extra_flags.0,
header.os.into(),
]
}
}
impl From<BaseHeader> for [u8; 10] {
fn from(header: BaseHeader) -> Self {
header.to_bytes()
}
}
pub enum CompressionMethod {
Deflate,
}