zip/read/config.rs
1//! Read Config
2
3/// Configuration for reading ZIP archives.
4#[repr(transparent)]
5#[derive(Debug, Default, Clone, Copy)]
6pub struct Config {
7 /// An offset into the reader to use to find the start of the archive.
8 pub archive_offset: ArchiveOffset,
9}
10
11/// The offset of the start of the archive from the beginning of the reader.
12#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
13pub enum ArchiveOffset {
14 /// Try to detect the archive offset automatically.
15 ///
16 /// This will look at the central directory specified by `FromCentralDirectory` for a header.
17 /// If missing, this will behave as if `None` were specified.
18 #[default]
19 Detect,
20 /// Use the central directory length and offset to determine the start of the archive.
21 #[deprecated(since = "2.3.0", note = "use `Detect` instead")]
22 FromCentralDirectory,
23 /// Specify a fixed archive offset.
24 Known(u64),
25}