1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
//! I/O abstractions for reading ZIP files from various sources.
//!
//! This module provides a unified interface for random-access reading,
//! allowing the ZIP parser to work with both local files and remote HTTP sources.
//!
//! ## Architecture
//!
//! The core abstraction is the [`ReadAt`] trait, which provides:
//! - Random access reads at arbitrary offsets
//! - Total size information for the data source
//!
//! ## Implementations
//!
//! - [`LocalFileReader`]: Reads from local filesystem using platform-specific
//! optimizations (pread on Unix, seek+read on Windows)
//! - [`HttpRangeReader`]: Reads from HTTP servers using Range requests,
//! enabling efficient partial downloads of remote archives
pub use HttpRangeReader;
pub use LocalFileReader;
use Result;
use async_trait;
/// Trait for random access reading from a data source.
///
/// This trait abstracts over different data sources (local files, HTTP, etc.)
/// to provide a unified interface for the ZIP parser. Implementations must
/// be thread-safe (`Send + Sync`) to support concurrent access.
///
/// # Example
///
/// ```ignore
/// async fn read_header<R: ReadAt>(reader: &R) -> Result<[u8; 4]> {
/// let mut buf = [0u8; 4];
/// reader.read_at(0, &mut buf).await?;
/// Ok(buf)
/// }
/// ```