-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #109 from afranchuk/configure-archive-offset
feat: Allow the archive offset behavior of the reader to be configured.
- Loading branch information
Showing
3 changed files
with
120 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/// Configuration for reading ZIP archives. | ||
#[repr(transparent)] | ||
#[derive(Debug, Default, Clone, Copy)] | ||
pub struct Config { | ||
/// An offset into the reader to use to find the start of the archive. | ||
pub archive_offset: ArchiveOffset, | ||
} | ||
|
||
/// The offset of the start of the archive from the beginning of the reader. | ||
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)] | ||
pub enum ArchiveOffset { | ||
/// Try to detect the archive offset automatically. | ||
/// | ||
/// This will look at the central directory specified by `FromCentralDirectory` for a header. | ||
/// If missing, this will behave as if `None` were specified. | ||
#[default] | ||
Detect, | ||
/// Use the central directory length and offset to determine the start of the archive. | ||
FromCentralDirectory, | ||
/// Specify a fixed archive offset. | ||
Known(u64), | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters