Skip to main content

ewf_image/
sections.rs

1/// On-disk section identifier, preserving unknown producer-defined types.
2#[derive(Debug, Clone, PartialEq, Eq)]
3#[cfg_attr(feature = "serde", derive(serde::Serialize))]
4pub enum SectionKind {
5    /// EWF1 ASCII section name.
6    Ewf1(String),
7    /// EWF2 numeric section identifier.
8    Ewf2(u32),
9}
10
11/// A section's location in its original segment. Payloads are not retained.
12/// These are the descriptors accepted during opening, not a fresh integrity check.
13#[derive(Debug, Clone, PartialEq, Eq)]
14#[cfg_attr(feature = "serde", derive(serde::Serialize))]
15#[non_exhaustive]
16pub struct SectionInfo {
17    /// Zero-based segment index, resolving through `Image::segment_filename`.
18    pub segment_index: usize,
19    /// Original section identifier.
20    pub kind: SectionKind,
21    /// Descriptor byte offset within the segment.
22    pub descriptor_offset: u64,
23    /// Payload byte offset within the segment.
24    pub data_offset: u64,
25    /// Payload byte length, excluding descriptor and padding.
26    pub data_size: u64,
27    /// EWF1 next descriptor or EWF2 previous descriptor offset.
28    pub linked_descriptor_offset: u64,
29    /// Raw EWF2 data flags; zero for EWF1.
30    pub data_flags: u32,
31}