#[non_exhaustive]pub enum SampleType {
I16,
I24,
I32,
F32,
F64,
Unknown,
}Expand description
Audio sample data types
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
I16
16-bit signed integer
I24
24-bit signed integer
I32
32-bit signed integer
F32
32-bit floating point
F64
64-bit floating point
Unknown
Unknown or unsupported sample type
Implementations§
Source§impl SampleType
impl SampleType
Sourcepub const fn description(self) -> &'static str
pub const fn description(self) -> &'static str
Returns a human-readable descriptive name
Sourcepub const fn is_integer(self) -> bool
pub const fn is_integer(self) -> bool
True if this is an integer-based sample format
Sourcepub const fn is_dsp_native(self) -> bool
pub const fn is_dsp_native(self) -> bool
True if this format is usable for DSP operations without conversion
Source§impl SampleType
impl SampleType
Sourcepub fn from_type_id(type_id: TypeId) -> Option<Self>
pub fn from_type_id(type_id: TypeId) -> Option<Self>
Returns the SampleType corresponding to a TypeId, or None if unrecognized.
This is useful for SIMD dispatch code that needs to determine the concrete sample type at runtime.
§Example
use audio_samples::SampleType;
use std::any::TypeId;
assert_eq!(SampleType::from_type_id(TypeId::of::<f32>()), Some(SampleType::F32));
assert_eq!(SampleType::from_type_id(TypeId::of::<String>()), None);Trait Implementations§
Source§impl Clone for SampleType
impl Clone for SampleType
Source§fn clone(&self) -> SampleType
fn clone(&self) -> SampleType
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 SampleType
impl Debug for SampleType
Source§impl Display for SampleType
impl Display for SampleType
Source§impl Hash for SampleType
impl Hash for SampleType
Source§impl PartialEq for SampleType
impl PartialEq for SampleType
Source§impl TryFrom<&str> for SampleType
impl TryFrom<&str> for SampleType
impl Copy for SampleType
impl Eq for SampleType
impl StructuralPartialEq for SampleType
Auto Trait Implementations§
impl Freeze for SampleType
impl RefUnwindSafe for SampleType
impl Send for SampleType
impl Sync for SampleType
impl Unpin for SampleType
impl UnwindSafe for SampleType
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