#[non_exhaustive]pub enum TranscodeContractError {
OverRead {
read: usize,
available: usize,
},
OverWritten {
written: usize,
available: usize,
},
ProgressIndexOverflow {
index: usize,
advanced: usize,
},
SatisfiedNeed {
required: usize,
available: usize,
},
CompleteWithRemainingInput {
read: usize,
available: usize,
},
}Expand description
Error reported when a transcoder returns inconsistent progress.
This error represents a broken crate::Transcoder implementation rather
than malformed input data. Buffered drivers call
crate::TranscodeProgress::validate before trusting progress counters for
unchecked buffer cursor movement.
§Examples
use qubit_codec::TranscodeContractError;
let error = TranscodeContractError::OverRead { read: 2, available: 1 };
assert_eq!(error.to_string(), "transcoder consumed 2 units but only 1 were available");Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
OverRead
The transcoder consumed more input units than the caller supplied.
Fields
OverWritten
The transcoder wrote more output units than the caller supplied.
Fields
ProgressIndexOverflow
Progress could not be represented as an absolute index.
Fields
SatisfiedNeed
A status requested input or output that is already available.
Fields
CompleteWithRemainingInput
A Complete status left visible input unconsumed.
Trait Implementations§
Source§impl Clone for TranscodeContractError
impl Clone for TranscodeContractError
impl Copy for TranscodeContractError
Source§impl Debug for TranscodeContractError
impl Debug for TranscodeContractError
Source§impl Display for TranscodeContractError
impl Display for TranscodeContractError
impl Eq for TranscodeContractError
Source§impl Error for TranscodeContractError
impl Error for TranscodeContractError
1.30.0 · 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()
Source§impl From<TranscodeContractError> for TranscodeFailure
impl From<TranscodeContractError> for TranscodeFailure
Source§fn from(error: TranscodeContractError) -> Self
fn from(error: TranscodeContractError) -> Self
Converts a broken transcoder progress report into a framework failure.
§Parameters
error: Progress-contract violation to retain as the error source.
§Returns
Returns Self::InvalidProgress carrying the original violation.