#[non_exhaustive]pub enum Error {
UnsupportedFormat(String),
UnsupportedCompression {
format: &'static str,
compression: String,
},
#[non_exhaustive] CorruptFile {
what: String,
offset: Option<u64>,
reason: Option<Box<CorruptReason>>,
},
InvalidMetadata(String),
CameraUnsupported {
make: String,
model: String,
reason: String,
},
GpuUnavailable(String),
OutOfMemory(String),
LimitExceeded(String),
NotAvailable(String),
InvalidArgument(String),
Io(Error),
}Expand description
All errors produced while parsing or decoding a RAW file.
Errors carry enough context (format, offset, what was being parsed) to make a failure on a corpus file actionable without a debugger.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
UnsupportedFormat(String)
The bytes do not look like any RAW format FlashRaw understands.
UnsupportedCompression
The container was understood but the payload uses an unsupported compression scheme.
Fields
#[non_exhaustive]CorruptFile
The file is structurally invalid (truncated, bad offsets, corrupt entropy data…).
Truncated sensor data carries a structured CorruptReason (see
Error::corrupt_reason and Error::truncation).
Fields
This variant is marked as non-exhaustive
reason: Option<Box<CorruptReason>>Structured cause, when known (e.g. which strip is truncated and by how much).
InvalidMetadata(String)
Metadata required for decoding is missing or nonsensical.
CameraUnsupported
The file format is supported but this camera or mode is not (yet).
Fields
A GPU backend was requested but is not available.
OutOfMemory(String)
An allocation would exceed configured limits or failed.
LimitExceeded(String)
Image dimensions or other values exceed configured safety limits.
NotAvailable(String)
The requested operation is not possible for this file (e.g. no preview, no tiles).
InvalidArgument(String)
Invalid caller-provided arguments (bad region, incompatible options…).
Io(Error)
I/O failure while reading input.
Implementations§
Source§impl Error
impl Error
Sourcepub fn corrupt(what: impl Display) -> Self
pub fn corrupt(what: impl Display) -> Self
Shorthand for a Error::CorruptFile without an offset.
Sourcepub fn corrupt_at(what: impl Display, offset: u64) -> Self
pub fn corrupt_at(what: impl Display, offset: u64) -> Self
Shorthand for a Error::CorruptFile with an offset.
Sourcepub fn truncated(t: Truncation) -> Self
pub fn truncated(t: Truncation) -> Self
A Error::CorruptFile for sensor data that extends past the end of the input.
Sourcepub fn corrupt_with(reason: CorruptReason) -> Self
pub fn corrupt_with(reason: CorruptReason) -> Self
A Error::CorruptFile with a structured reason.
Sourcepub fn or_truncated(
self,
file_len: usize,
unit: DataUnit,
offset: usize,
declared: usize,
) -> Self
pub fn or_truncated( self, file_len: usize, unit: DataUnit, offset: usize, declared: usize, ) -> Self
Attribute a failure to decode a compressed range to truncation when that range
(declared bytes at offset) runs past the end of a file_len-byte input: the
error becomes a structured CorruptReason::Truncated report. Other errors, and
ranges inside the file, are returned unchanged. (Compressed streams are only
known to be short when the decoder runs out of data, so the range is not checked
up front.)
Sourcepub fn corrupt_reason(&self) -> Option<&CorruptReason>
pub fn corrupt_reason(&self) -> Option<&CorruptReason>
The structured cause of a Error::CorruptFile, when known.
Sourcepub fn truncation(&self) -> Option<&Truncation>
pub fn truncation(&self) -> Option<&Truncation>
Details of truncated sensor data (a CorruptReason::Truncated corruption).
Sourcepub fn invalid_metadata(what: impl Display) -> Self
pub fn invalid_metadata(what: impl Display) -> Self
Shorthand for an Error::InvalidMetadata.
Sourcepub fn unsupported_compression(
format: &'static str,
compression: impl Display,
) -> Self
pub fn unsupported_compression( format: &'static str, compression: impl Display, ) -> Self
Shorthand for an Error::UnsupportedCompression.
Trait Implementations§
Source§impl Error for Error
impl Error for Error
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Auto Trait Implementations§
impl !RefUnwindSafe for Error
impl !UnwindSafe for Error
impl Freeze for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl UnsafeUnpin for Error
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more