#[non_exhaustive]pub enum SampleFormat {
S16,
S24,
S32,
F32,
U8,
}Expand description
PCM sample format (bit depth + encoding).
Tier: T2-P (Σ Sum — format variant union)
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.
S16
Signed 16-bit integer (CD quality).
S24
Signed 24-bit integer (packed, studio quality).
S32
Signed 32-bit integer.
F32
32-bit IEEE float [-1.0, 1.0].
U8
8-bit unsigned (legacy).
Implementations§
Source§impl SampleFormat
impl SampleFormat
Sourcepub const fn bytes_per_sample(self) -> usize
pub const fn bytes_per_sample(self) -> usize
Bytes per sample for this format.
Sourcepub const fn bits_per_sample(self) -> u32
pub const fn bits_per_sample(self) -> u32
Bits per sample.
Sourcepub const fn is_integer(self) -> bool
pub const fn is_integer(self) -> bool
Whether this is an integer format.
Trait Implementations§
Source§impl Clone for SampleFormat
impl Clone for SampleFormat
Source§fn clone(&self) -> SampleFormat
fn clone(&self) -> SampleFormat
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 SampleFormat
impl Debug for SampleFormat
Source§impl<'de> Deserialize<'de> for SampleFormat
impl<'de> Deserialize<'de> for SampleFormat
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for SampleFormat
impl Display for SampleFormat
Source§impl Hash for SampleFormat
impl Hash for SampleFormat
Source§impl PartialEq for SampleFormat
impl PartialEq for SampleFormat
Source§impl Serialize for SampleFormat
impl Serialize for SampleFormat
impl Copy for SampleFormat
impl Eq for SampleFormat
impl StructuralPartialEq for SampleFormat
Auto Trait Implementations§
impl Freeze for SampleFormat
impl RefUnwindSafe for SampleFormat
impl Send for SampleFormat
impl Sync for SampleFormat
impl Unpin for SampleFormat
impl UnsafeUnpin for SampleFormat
impl UnwindSafe for SampleFormat
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