Skip to main content

musefs_format/
probe.rs

1//! Shared outcome type for *bounded* metadata probing: a format parser is given
2//! only a `prefix` of the file (plus the true `file_len`) and either completes,
3//! or reports the exact byte offset it must reach to continue.
4
5/// Result of a bounded metadata probe.
6#[derive(Debug, Clone, PartialEq, Eq)]
7pub enum Extent<T> {
8    /// The metadata region is fully present in the prefix; here is the parse.
9    Complete(T),
10    /// The prefix is too short. Read at least up to `up_to` bytes (capped at the
11    /// file length) and retry. `up_to` is strictly greater than the current
12    /// prefix length unless the parser cannot bound its need, in which case the
13    /// caller falls back to reading the whole file.
14    NeedMore { up_to: u64 },
15}