#[non_exhaustive]pub enum ProcessingError {
MathematicalFailure {
operation: String,
reason: String,
},
AlgorithmFailure {
algorithm: String,
reason: String,
},
InsufficientData {
operation: String,
reason: String,
},
ConvergenceFailure {
algorithm: String,
iterations: u32,
},
ExternalDependency {
dependency: String,
operation: String,
reason: String,
},
}Expand description
Errors that occur during audio processing operations.
§Purpose
Covers failures in DSP algorithms, mathematical operations, and other processing-specific issues that don’t belong in the conversion, parameter, or layout domains.
§Intended Usage
Return these errors when a processing algorithm cannot complete successfully.
Use MathematicalFailure for
arithmetic issues, AlgorithmFailure
for general algorithm errors, and
ConvergenceFailure when an
iterative algorithm exhausts its iteration budget.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
MathematicalFailure
A mathematical operation failed due to invalid input or numerical issues.
Fields
AlgorithmFailure
An audio processing algorithm encountered an error during execution.
Fields
InsufficientData
The operation failed due to insufficient data or resources.
Fields
ConvergenceFailure
A convergence-based algorithm failed to converge within limits.
Fields
ExternalDependency
An external dependency or resource required for processing is unavailable.
Implementations§
Source§impl ProcessingError
impl ProcessingError
Sourcepub fn algorithm_failure<A, R>(algorithm: A, reason: R) -> Self
pub fn algorithm_failure<A, R>(algorithm: A, reason: R) -> Self
Creates a ProcessingError::AlgorithmFailure error.
Use this when a DSP or signal-processing algorithm cannot complete successfully for reasons intrinsic to the algorithm itself, such as filter instability or a failed FFT plan.
§Arguments
algorithm— Name of the processing algorithm that failed.reason— Human-readable explanation of what went wrong.
§Returns
A ProcessingError::AlgorithmFailure variant.
§Examples
use audio_samples::ProcessingError;
let err = ProcessingError::algorithm_failure("butterworth", "filter became unstable");
assert!(matches!(err, ProcessingError::AlgorithmFailure { .. }));Sourcepub fn mathematical_failure<O, R>(operation: O, reason: R) -> Self
pub fn mathematical_failure<O, R>(operation: O, reason: R) -> Self
Creates a ProcessingError::MathematicalFailure error.
§Arguments
operation— The mathematical operation that failed.reason— Why it failed (e.g. NaN, division by zero).
§Returns
A ProcessingError::MathematicalFailure variant.
Sourcepub fn external_dependency<D, O, R>(
dependency: D,
operation: O,
reason: R,
) -> Self
pub fn external_dependency<D, O, R>( dependency: D, operation: O, reason: R, ) -> Self
Creates a ProcessingError::ExternalDependency error.
Use this when an external backend (e.g. the rubato resampler) reports a
failure. The originating error’s message is captured in reason.
§Arguments
dependency— The external dependency that failed (e.g."rubato").operation— The operation that required the dependency.reason— The failure detail (often the foreign error’s message).
§Returns
A ProcessingError::ExternalDependency variant.
Sourcepub fn insufficient_data<O, R>(operation: O, reason: R) -> Self
pub fn insufficient_data<O, R>(operation: O, reason: R) -> Self
Creates a ProcessingError::InsufficientData error.
§Arguments
operation— The operation that needs more data.reason— Explanation of the data requirement.
§Returns
A ProcessingError::InsufficientData variant.
Trait Implementations§
Source§impl Clone for ProcessingError
impl Clone for ProcessingError
Source§fn clone(&self) -> ProcessingError
fn clone(&self) -> ProcessingError
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ProcessingError
impl Debug for ProcessingError
Source§impl Diagnostic for ProcessingError
impl Diagnostic for ProcessingError
Source§fn code(&self) -> Option<Box<dyn Display + '_>>
fn code(&self) -> Option<Box<dyn Display + '_>>
Diagnostic. Ideally also globally unique, and documented
in the toplevel crate’s documentation for easy searching. Rust path
format (foo::bar::baz) is recommended, but more classic codes like
E0123 or enums will work just fine.Source§fn help(&self) -> Option<Box<dyn Display + '_>>
fn help(&self) -> Option<Box<dyn Display + '_>>
Diagnostic. Do you have any
advice for the poor soul who’s just run into this issue?Source§fn url(&self) -> Option<Box<dyn Display + '_>>
fn url(&self) -> Option<Box<dyn Display + '_>>
Diagnostic.Source§fn severity(&self) -> Option<Severity>
fn severity(&self) -> Option<Severity>
ReportHandlers to change the display format
of this diagnostic. Read moreSource§fn source_code(&self) -> Option<&dyn SourceCode>
fn source_code(&self) -> Option<&dyn SourceCode>
Diagnostic’s Diagnostic::labels to.Source§fn labels(&self) -> Option<Box<dyn Iterator<Item = LabeledSpan> + '_>>
fn labels(&self) -> Option<Box<dyn Iterator<Item = LabeledSpan> + '_>>
Diagnostic’s Diagnostic::source_codeDiagnostics.Source§fn diagnostic_source(&self) -> Option<&dyn Diagnostic>
fn diagnostic_source(&self) -> Option<&dyn Diagnostic>
Source§impl Display for ProcessingError
impl Display for ProcessingError
Source§impl Error for ProcessingError
impl Error for ProcessingError
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<ProcessingError> for AudioSampleError
impl From<ProcessingError> for AudioSampleError
Source§fn from(source: ProcessingError) -> Self
fn from(source: ProcessingError) -> Self
Auto Trait Implementations§
impl Freeze for ProcessingError
impl RefUnwindSafe for ProcessingError
impl Send for ProcessingError
impl Sync for ProcessingError
impl Unpin for ProcessingError
impl UnsafeUnpin for ProcessingError
impl UnwindSafe for ProcessingError
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Src, Dst> ConvertTo<Dst> for Srcwhere
Dst: ConvertFrom<Src>,
impl<Src, Dst> ConvertTo<Dst> for Srcwhere
Dst: ConvertFrom<Src>,
Source§fn convert_to(self) -> Dst
fn convert_to(self) -> Dst
Dst using audio-aware scaling. Read moreSource§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