pub enum ConversionError {
AudioConversion {
value: String,
source_type: String,
target_type: String,
reason: String,
},
NumericCast {
value: String,
source_type: String,
target_type: String,
reason: String,
},
UnsupportedConversion {
source_type: String,
target_type: String,
},
}Expand description
Errors that occur during type conversion and casting operations.
This covers both audio-aware conversions (e.g., i16 ↔ f32 with normalization) and raw numeric casting operations between sample types.
Variants§
AudioConversion
Failed to convert between audio sample types with audio-aware scaling.
Fields
NumericCast
Failed to perform raw numeric casting between types.
Fields
UnsupportedConversion
The conversion operation is not supported between the specified types.
Implementations§
Source§impl ConversionError
impl ConversionError
Sourcepub fn audio_conversion<V, S, T, R>(
value: V,
source_type: S,
target_type: T,
reason: R,
) -> Self
pub fn audio_conversion<V, S, T, R>( value: V, source_type: S, target_type: T, reason: R, ) -> Self
Create a new audio conversion error.
Trait Implementations§
Source§impl Clone for ConversionError
impl Clone for ConversionError
Source§fn clone(&self) -> ConversionError
fn clone(&self) -> ConversionError
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ConversionError
impl Debug for ConversionError
Source§impl Display for ConversionError
impl Display for ConversionError
Source§impl Error for ConversionError
impl Error for ConversionError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
Source§impl From<ConversionError> for AudioSampleError
impl From<ConversionError> for AudioSampleError
Source§fn from(source: ConversionError) -> Self
fn from(source: ConversionError) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for ConversionError
impl RefUnwindSafe for ConversionError
impl Send for ConversionError
impl Sync for ConversionError
impl Unpin for ConversionError
impl UnwindSafe for ConversionError
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
Mutably borrows from an owned value. Read more