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
use crate::casc_file_frame::CascFileFrame;
use std::io::Read;
/// Represents a span in a CASC file, including offsets and file frames.
///
/// A `CascFileSpan` describes a contiguous region of a file within the CASC storage,
/// including its offsets and the frames it contains.
pub struct CascFileSpan<R: Read> {
/// The reader for the span (if any).
pub(crate) span_reader: R,
/// The virtual start offset of the span.
pub(crate) virtual_start_offset: u64,
/// The virtual end offset of the span.
pub(crate) virtual_end_offset: u64,
/// The archive offset of the span.
pub(crate) archive_offset: u64,
/// The file frames within this span.
pub(crate) frames: Vec<CascFileFrame>,
}
impl<R: Read> CascFileSpan<R> {
/// Creates a new `CascFileSpan` with all fields specified.
pub(crate) fn new(
span_reader: R,
virtual_start_offset: u64,
virtual_end_offset: u64,
archive_offset: u64,
frames: Vec<CascFileFrame>,
) -> Self {
Self {
span_reader,
virtual_start_offset,
virtual_end_offset,
archive_offset,
frames,
}
}
}