commit
769fff2035
2 changed files with 21 additions and 4 deletions
|
@ -31,7 +31,6 @@ displaydoc = { version = "0.2.4", default-features = false }
|
||||||
flate2 = { version = "1.0.28", default-features = false, optional = true }
|
flate2 = { version = "1.0.28", default-features = false, optional = true }
|
||||||
indexmap = "2"
|
indexmap = "2"
|
||||||
hmac = { version = "0.12.1", optional = true, features = ["reset"] }
|
hmac = { version = "0.12.1", optional = true, features = ["reset"] }
|
||||||
num_enum = "0.7.2"
|
|
||||||
pbkdf2 = { version = "0.12.2", optional = true }
|
pbkdf2 = { version = "0.12.2", optional = true }
|
||||||
rand = { version = "0.8.5", optional = true }
|
rand = { version = "0.8.5", optional = true }
|
||||||
sha1 = { version = "0.10.6", optional = true }
|
sha1 = { version = "0.10.6", optional = true }
|
||||||
|
|
24
src/types.rs
24
src/types.rs
|
@ -1,5 +1,4 @@
|
||||||
//! Types that specify what is contained in a ZIP.
|
//! Types that specify what is contained in a ZIP.
|
||||||
use num_enum::{FromPrimitive, IntoPrimitive};
|
|
||||||
use path::{Component, Path, PathBuf};
|
use path::{Component, Path, PathBuf};
|
||||||
use std::path;
|
use std::path;
|
||||||
use std::sync::{Arc, OnceLock};
|
use std::sync::{Arc, OnceLock};
|
||||||
|
@ -21,15 +20,34 @@ use crate::CompressionMethod;
|
||||||
#[cfg(feature = "time")]
|
#[cfg(feature = "time")]
|
||||||
use time::{error::ComponentRange, Date, Month, OffsetDateTime, PrimitiveDateTime, 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)]
|
#[repr(u8)]
|
||||||
pub enum System {
|
pub enum System {
|
||||||
Dos = 0,
|
Dos = 0,
|
||||||
Unix = 3,
|
Unix = 3,
|
||||||
#[num_enum(default)]
|
|
||||||
Unknown,
|
Unknown,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl From<u8> for System {
|
||||||
|
fn from(system: u8) -> Self {
|
||||||
|
match system {
|
||||||
|
0 => Self::Dos,
|
||||||
|
3 => Self::Unix,
|
||||||
|
_ => Self::Unknown,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<System> for u8 {
|
||||||
|
fn from(system: System) -> Self {
|
||||||
|
match system {
|
||||||
|
System::Dos => 0,
|
||||||
|
System::Unix => 3,
|
||||||
|
System::Unknown => 4,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Representation of a moment in time.
|
/// Representation of a moment in time.
|
||||||
///
|
///
|
||||||
/// Zip files use an old format from DOS to store timestamps,
|
/// Zip files use an old format from DOS to store timestamps,
|
||||||
|
|
Loading…
Add table
Reference in a new issue