Trait rustpotter::Sample

source ·
pub trait Sample: Sized + Copy + PartialOrd + Display + 'static + Send {
    const S_TYPE: SampleFormat;

    // Required methods
    fn get_byte_size() -> usize;
    fn get_format() -> SampleFormat;
    fn get_zero() -> Self;
    fn from_le_bytes(bytes: &[u8]) -> Self;
    fn from_be_bytes(bytes: &[u8]) -> Self;
    fn from_ne_bytes(bytes: &[u8]) -> Self;
    fn into_f32(self) -> f32;
}
Expand description

Trait for compatible sample number types

Required Associated Constants§

Required Methods§

source

fn get_byte_size() -> usize

source

fn get_format() -> SampleFormat

source

fn get_zero() -> Self

source

fn from_le_bytes(bytes: &[u8]) -> Self

source

fn from_be_bytes(bytes: &[u8]) -> Self

source

fn from_ne_bytes(bytes: &[u8]) -> Self

source

fn into_f32(self) -> f32

Implementations on Foreign Types§

source§

impl Sample for i8

source§

const S_TYPE: SampleFormat = SampleFormat::I8

source§

fn get_byte_size() -> usize

source§

fn get_format() -> SampleFormat

source§

fn get_zero() -> Self

source§

fn into_f32(self) -> f32

source§

fn from_le_bytes(bytes: &[u8]) -> Self

source§

fn from_be_bytes(bytes: &[u8]) -> Self

source§

fn from_ne_bytes(bytes: &[u8]) -> Self

source§

impl Sample for i32

source§

const S_TYPE: SampleFormat = SampleFormat::I32

source§

fn get_byte_size() -> usize

source§

fn get_format() -> SampleFormat

source§

fn get_zero() -> Self

source§

fn into_f32(self) -> f32

source§

fn from_le_bytes(bytes: &[u8]) -> Self

source§

fn from_be_bytes(bytes: &[u8]) -> Self

source§

fn from_ne_bytes(bytes: &[u8]) -> Self

source§

impl Sample for i16

source§

const S_TYPE: SampleFormat = SampleFormat::I16

source§

fn get_byte_size() -> usize

source§

fn get_format() -> SampleFormat

source§

fn get_zero() -> Self

source§

fn into_f32(self) -> f32

source§

fn from_le_bytes(bytes: &[u8]) -> Self

source§

fn from_be_bytes(bytes: &[u8]) -> Self

source§

fn from_ne_bytes(bytes: &[u8]) -> Self

source§

impl Sample for f32

source§

const S_TYPE: SampleFormat = SampleFormat::F32

source§

fn get_byte_size() -> usize

source§

fn get_format() -> SampleFormat

source§

fn get_zero() -> Self

source§

fn into_f32(self) -> f32

source§

fn from_le_bytes(bytes: &[u8]) -> Self

source§

fn from_be_bytes(bytes: &[u8]) -> Self

source§

fn from_ne_bytes(bytes: &[u8]) -> Self

Implementors§