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, os: Os,
} }
impl BaseHeader { impl From<BaseHeader> for [u8; 10] {
const SIZE: usize = 10; fn from(header: BaseHeader) -> Self {
let mtime: [u8; 4] = header.last_modified.into();
fn to_bytes(self) -> [u8; Self::SIZE] {
let mtime: [u8; 4] = self.last_modified.into();
[ [
ID1, ID1,
ID2, ID2,
self.compression_method.into(), header.compression_method.into(),
self.flags.0, header.flags.0,
mtime[0], mtime[0],
mtime[1], mtime[1],
mtime[2], mtime[2],
mtime[3], mtime[3],
self.extra_flags.0, header.extra_flags.0,
self.os.into(), header.os.into(),
] ]
} }
} }
impl From<BaseHeader> for [u8; 10] {
fn from(header: BaseHeader) -> Self {
header.to_bytes()
}
}
pub enum CompressionMethod { pub enum CompressionMethod {
Deflate, Deflate,
} }