Skip to main content

SizedSample

Trait SizedSample 

Source
pub trait SizedSample: Sample {
    const FORMAT: SampleFormat;
}
Expand description

A Sample type with a known corresponding SampleFormat.

This trait is automatically implemented for all primitive sample types and provides a way to determine the SampleFormat at compile time.

§Example

use cpal::SizedSample;

assert_eq!(i16::FORMAT, cpal::SampleFormat::I16);
assert_eq!(f32::FORMAT, cpal::SampleFormat::F32);

Required Associated Constants§

Source

const FORMAT: SampleFormat

The corresponding SampleFormat for this sample type.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl SizedSample for f32

Source§

const FORMAT: SampleFormat = SampleFormat::F32

Source§

impl SizedSample for f64

Source§

const FORMAT: SampleFormat = SampleFormat::F64

Source§

impl SizedSample for i8

Source§

const FORMAT: SampleFormat = SampleFormat::I8

Source§

impl SizedSample for i16

Source§

const FORMAT: SampleFormat = SampleFormat::I16

Source§

impl SizedSample for i32

Source§

const FORMAT: SampleFormat = SampleFormat::I32

Source§

impl SizedSample for i64

Source§

const FORMAT: SampleFormat = SampleFormat::I64

Source§

impl SizedSample for u8

Source§

const FORMAT: SampleFormat = SampleFormat::U8

Source§

impl SizedSample for u16

Source§

const FORMAT: SampleFormat = SampleFormat::U16

Source§

impl SizedSample for u32

Source§

const FORMAT: SampleFormat = SampleFormat::U32

Source§

impl SizedSample for u64

Source§

const FORMAT: SampleFormat = SampleFormat::U64

Implementors§

Source§

impl SizedSample for I24

Source§

const FORMAT: SampleFormat = SampleFormat::I24

Source§

impl SizedSample for U24

Source§

const FORMAT: SampleFormat = SampleFormat::U24