diff --git a/Cargo.toml b/Cargo.toml index bcd6119e1..95d0e22a6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,7 +31,6 @@ displaydoc = { version = "0.2.4", default-features = false } flate2 = { version = "1.0.28", default-features = false, optional = true } indexmap = "2" hmac = { version = "0.12.1", optional = true, features = ["reset"] } -num_enum = "0.7.2" pbkdf2 = { version = "0.12.2", optional = true } rand = { version = "0.8.5", optional = true } sha1 = { version = "0.10.6", optional = true } diff --git a/src/types.rs b/src/types.rs index bba8241a7..00a851da1 100644 --- a/src/types.rs +++ b/src/types.rs @@ -1,5 +1,4 @@ //! Types that specify what is contained in a ZIP. -use num_enum::{FromPrimitive, IntoPrimitive}; use path::{Component, Path, PathBuf}; use std::path; use std::sync::{Arc, OnceLock}; @@ -21,15 +20,34 @@ use crate::CompressionMethod; #[cfg(feature = "time")] use time::{error::ComponentRange, Date, Month, OffsetDateTime, PrimitiveDateTime, Time}; -#[derive(Clone, Copy, Debug, PartialEq, Eq, FromPrimitive, IntoPrimitive)] +#[derive(Clone, Copy, Debug, PartialEq, Eq)] #[repr(u8)] pub enum System { Dos = 0, Unix = 3, - #[num_enum(default)] Unknown, } +impl From for System { + fn from(system: u8) -> Self { + match system { + 0 => Self::Dos, + 3 => Self::Unix, + _ => Self::Unknown, + } + } +} + +impl From for u8 { + fn from(system: System) -> Self { + match system { + System::Dos => 0, + System::Unix => 3, + System::Unknown => 4, + } + } +} + /// Representation of a moment in time. /// /// Zip files use an old format from DOS to store timestamps,