Trait SampleType

Source
pub trait SampleType:
    Add<Output = Self>
    + Sub<Output = Self>
    + Mul<Output = Self>
    + Div<Output = Self>
    + AddAssign
    + SubAssign
    + MulAssign
    + DivAssign
    + Debug
    + Sized
    + Clone
    + Copy
    + 'static {
    type Longer;
    type Shorter;
    type Signed;
    type Unsigned;

Show 30 methods // Required methods fn new() -> Self; fn from(v: impl SampleType) -> Self; fn average(s1: Self, s2: Self) -> Self; fn average_arr(arr: &[Self]) -> Self; fn to_i8(&self) -> i8; fn to_i16(&self) -> i16; fn to_i32(&self) -> i32; fn to_i64(&self) -> i64; fn to_u8(&self) -> u8; fn to_u16(&self) -> u16; fn to_u32(&self) -> u32; fn to_u64(&self) -> u64; fn to_i24(&self) -> i24; fn to_u24(&self) -> u24; fn to_f32(&self) -> f32; fn to_f64(&self) -> f64; fn as_i24(&self) -> i24; fn as_u24(&self) -> u24; fn to_longer(&self) -> Self::Longer; fn to_shorter(&self) -> Self::Shorter; fn is_signed(&self) -> bool; fn is_unsigned(&self) -> bool; fn is_integer(&self) -> bool; fn is_float(&self) -> bool; fn to_signed(&self) -> Self::Signed; fn read_le<T>(r: &mut T) -> Result<Self, Error> where T: Read + ?Sized; fn read_be<T>(r: &mut T) -> Result<Self, Error> where T: Read + ?Sized; fn write_le<T>(&self, w: &mut T) -> Result<(), Error> where T: Write + ?Sized; fn write_be<T>(&self, w: &mut T) -> Result<(), Error> where T: Write + ?Sized; // Provided method fn to_unsigned(&self) -> Self::Unsigned { ... }
}

Required Associated Types§

Required Methods§

Source

fn new() -> Self

Source

fn from(v: impl SampleType) -> Self

Source

fn average(s1: Self, s2: Self) -> Self

Source

fn average_arr(arr: &[Self]) -> Self

Source

fn to_i8(&self) -> i8

Source

fn to_i16(&self) -> i16

Source

fn to_i32(&self) -> i32

Source

fn to_i64(&self) -> i64

Source

fn to_u8(&self) -> u8

Source

fn to_u16(&self) -> u16

Source

fn to_u32(&self) -> u32

Source

fn to_u64(&self) -> u64

Source

fn to_i24(&self) -> i24

Source

fn to_u24(&self) -> u24

Source

fn to_f32(&self) -> f32

Source

fn to_f64(&self) -> f64

Source

fn as_i24(&self) -> i24

Source

fn as_u24(&self) -> u24

Source

fn to_longer(&self) -> Self::Longer

Source

fn to_shorter(&self) -> Self::Shorter

Source

fn is_signed(&self) -> bool

Source

fn is_unsigned(&self) -> bool

Source

fn is_integer(&self) -> bool

Source

fn is_float(&self) -> bool

Source

fn to_signed(&self) -> Self::Signed

Source

fn read_le<T>(r: &mut T) -> Result<Self, Error>
where T: Read + ?Sized,

Source

fn read_be<T>(r: &mut T) -> Result<Self, Error>
where T: Read + ?Sized,

Source

fn write_le<T>(&self, w: &mut T) -> Result<(), Error>
where T: Write + ?Sized,

Source

fn write_be<T>(&self, w: &mut T) -> Result<(), Error>
where T: Write + ?Sized,

Provided Methods§

Source

fn to_unsigned(&self) -> Self::Unsigned

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 SampleType for f32

Source§

type Shorter = f32

Source§

type Longer = f64

Source§

type Signed = f32

Source§

type Unsigned = f32

Source§

fn new() -> Self

Source§

fn from(v: impl SampleType) -> f32

Source§

fn average(s1: f32, s2: f32) -> f32

Source§

fn average_arr(arr: &[Self]) -> Self

Source§

fn to_i8(&self) -> i8

Source§

fn to_i16(&self) -> i16

Source§

fn to_i32(&self) -> i32

Source§

fn to_i64(&self) -> i64

Source§

fn to_u8(&self) -> u8

Source§

fn to_u16(&self) -> u16

Source§

fn to_u32(&self) -> u32

Source§

fn to_u64(&self) -> u64

Source§

fn to_i24(&self) -> i24

Source§

fn to_u24(&self) -> u24

Source§

fn as_i24(&self) -> i24

Source§

fn as_u24(&self) -> u24

Source§

fn to_f32(&self) -> f32

Source§

fn to_f64(&self) -> f64

Source§

fn to_longer(&self) -> Self::Longer

Source§

fn to_shorter(&self) -> Self::Shorter

Source§

fn is_signed(&self) -> bool

Source§

fn is_unsigned(&self) -> bool

Source§

fn is_integer(&self) -> bool

Source§

fn is_float(&self) -> bool

Source§

fn to_signed(&self) -> Self::Signed

Source§

fn read_le<T>(r: &mut T) -> Result<Self, Error>
where T: Read + ?Sized,

Source§

fn read_be<T>(r: &mut T) -> Result<Self, Error>
where T: Read + ?Sized,

Source§

fn write_le<T>(&self, w: &mut T) -> Result<(), Error>
where T: Write + ?Sized,

Source§

fn write_be<T>(&self, w: &mut T) -> Result<(), Error>
where T: Write + ?Sized,

Source§

impl SampleType for f64

Source§

type Shorter = f32

Source§

type Longer = f64

Source§

type Signed = f64

Source§

type Unsigned = f64

Source§

fn new() -> Self

Source§

fn from(v: impl SampleType) -> f64

Source§

fn average(s1: f64, s2: f64) -> f64

Source§

fn average_arr(arr: &[Self]) -> Self

Source§

fn to_i8(&self) -> i8

Source§

fn to_i16(&self) -> i16

Source§

fn to_i32(&self) -> i32

Source§

fn to_i64(&self) -> i64

Source§

fn to_u8(&self) -> u8

Source§

fn to_u16(&self) -> u16

Source§

fn to_u32(&self) -> u32

Source§

fn to_u64(&self) -> u64

Source§

fn to_i24(&self) -> i24

Source§

fn to_u24(&self) -> u24

Source§

fn as_i24(&self) -> i24

Source§

fn as_u24(&self) -> u24

Source§

fn to_f32(&self) -> f32

Source§

fn to_f64(&self) -> f64

Source§

fn to_longer(&self) -> Self::Longer

Source§

fn to_shorter(&self) -> Self::Shorter

Source§

fn is_signed(&self) -> bool

Source§

fn is_unsigned(&self) -> bool

Source§

fn is_integer(&self) -> bool

Source§

fn is_float(&self) -> bool

Source§

fn to_signed(&self) -> Self::Signed

Source§

fn read_le<T>(r: &mut T) -> Result<Self, Error>
where T: Read + ?Sized,

Source§

fn read_be<T>(r: &mut T) -> Result<Self, Error>
where T: Read + ?Sized,

Source§

fn write_le<T>(&self, w: &mut T) -> Result<(), Error>
where T: Write + ?Sized,

Source§

fn write_be<T>(&self, w: &mut T) -> Result<(), Error>
where T: Write + ?Sized,

Source§

impl SampleType for i8

Source§

type Longer = i16

Source§

type Shorter = i8

Source§

type Signed = i8

Source§

type Unsigned = u8

Source§

fn new() -> Self

Source§

fn from(v: impl SampleType) -> i8

Source§

fn average(s1: i8, s2: i8) -> i8

Source§

fn average_arr(arr: &[Self]) -> Self

Source§

fn to_i8(&self) -> i8

Source§

fn to_i16(&self) -> i16

Source§

fn to_i32(&self) -> i32

Source§

fn to_i64(&self) -> i64

Source§

fn to_u8(&self) -> u8

Source§

fn to_u16(&self) -> u16

Source§

fn to_u32(&self) -> u32

Source§

fn to_u64(&self) -> u64

Source§

fn to_i24(&self) -> i24

Source§

fn to_u24(&self) -> u24

Source§

fn as_i24(&self) -> i24

Source§

fn as_u24(&self) -> u24

Source§

fn to_f32(&self) -> f32

Source§

fn to_f64(&self) -> f64

Source§

fn to_longer(&self) -> Self::Longer

Source§

fn to_shorter(&self) -> Self::Shorter

Source§

fn is_signed(&self) -> bool

Source§

fn is_unsigned(&self) -> bool

Source§

fn is_integer(&self) -> bool

Source§

fn is_float(&self) -> bool

Source§

fn to_signed(&self) -> Self::Signed

Source§

fn to_unsigned(&self) -> Self::Unsigned

Source§

fn read_le<T>(r: &mut T) -> Result<Self, Error>
where T: Read + ?Sized,

Source§

fn read_be<T>(r: &mut T) -> Result<Self, Error>
where T: Read + ?Sized,

Source§

fn write_le<T>(&self, w: &mut T) -> Result<(), Error>
where T: Write + ?Sized,

Source§

fn write_be<T>(&self, w: &mut T) -> Result<(), Error>
where T: Write + ?Sized,

Source§

impl SampleType for i16

Source§

type Longer = i24

Source§

type Shorter = i8

Source§

type Signed = i16

Source§

type Unsigned = u16

Source§

fn new() -> Self

Source§

fn from(v: impl SampleType) -> i16

Source§

fn average(s1: i16, s2: i16) -> i16

Source§

fn average_arr(arr: &[Self]) -> Self

Source§

fn to_i8(&self) -> i8

Source§

fn to_i16(&self) -> i16

Source§

fn to_i32(&self) -> i32

Source§

fn to_i64(&self) -> i64

Source§

fn to_u8(&self) -> u8

Source§

fn to_u16(&self) -> u16

Source§

fn to_u32(&self) -> u32

Source§

fn to_u64(&self) -> u64

Source§

fn to_i24(&self) -> i24

Source§

fn to_u24(&self) -> u24

Source§

fn as_i24(&self) -> i24

Source§

fn as_u24(&self) -> u24

Source§

fn to_f32(&self) -> f32

Source§

fn to_f64(&self) -> f64

Source§

fn to_longer(&self) -> Self::Longer

Source§

fn to_shorter(&self) -> Self::Shorter

Source§

fn is_signed(&self) -> bool

Source§

fn is_unsigned(&self) -> bool

Source§

fn is_integer(&self) -> bool

Source§

fn is_float(&self) -> bool

Source§

fn to_signed(&self) -> Self::Signed

Source§

fn to_unsigned(&self) -> Self::Unsigned

Source§

fn read_le<T>(r: &mut T) -> Result<Self, Error>
where T: Read + ?Sized,

Source§

fn read_be<T>(r: &mut T) -> Result<Self, Error>
where T: Read + ?Sized,

Source§

fn write_le<T>(&self, w: &mut T) -> Result<(), Error>
where T: Write + ?Sized,

Source§

fn write_be<T>(&self, w: &mut T) -> Result<(), Error>
where T: Write + ?Sized,

Source§

impl SampleType for i32

Source§

type Shorter = i16

Source§

type Longer = i64

Source§

type Signed = i32

Source§

type Unsigned = u32

Source§

fn new() -> Self

Source§

fn from(v: impl SampleType) -> i32

Source§

fn average(s1: i32, s2: i32) -> i32

Source§

fn average_arr(arr: &[Self]) -> Self

Source§

fn to_i8(&self) -> i8

Source§

fn to_i16(&self) -> i16

Source§

fn to_i32(&self) -> i32

Source§

fn to_i64(&self) -> i64

Source§

fn to_u8(&self) -> u8

Source§

fn to_u16(&self) -> u16

Source§

fn to_u32(&self) -> u32

Source§

fn to_u64(&self) -> u64

Source§

fn to_i24(&self) -> i24

Source§

fn to_u24(&self) -> u24

Source§

fn as_i24(&self) -> i24

Source§

fn as_u24(&self) -> u24

Source§

fn to_f32(&self) -> f32

Source§

fn to_f64(&self) -> f64

Source§

fn to_longer(&self) -> Self::Longer

Source§

fn to_shorter(&self) -> Self::Shorter

Source§

fn is_signed(&self) -> bool

Source§

fn is_unsigned(&self) -> bool

Source§

fn is_integer(&self) -> bool

Source§

fn is_float(&self) -> bool

Source§

fn to_signed(&self) -> Self::Signed

Source§

fn to_unsigned(&self) -> Self::Unsigned

Source§

fn read_le<T>(r: &mut T) -> Result<Self, Error>
where T: Read + ?Sized,

Source§

fn read_be<T>(r: &mut T) -> Result<Self, Error>
where T: Read + ?Sized,

Source§

fn write_le<T>(&self, w: &mut T) -> Result<(), Error>
where T: Write + ?Sized,

Source§

fn write_be<T>(&self, w: &mut T) -> Result<(), Error>
where T: Write + ?Sized,

Source§

impl SampleType for i64

Source§

type Shorter = i32

Source§

type Longer = i64

Source§

type Signed = i64

Source§

type Unsigned = u64

Source§

fn new() -> Self

Source§

fn from(v: impl SampleType) -> i64

Source§

fn average(s1: i64, s2: i64) -> i64

Source§

fn average_arr(arr: &[Self]) -> Self

Source§

fn to_i8(&self) -> i8

Source§

fn to_i16(&self) -> i16

Source§

fn to_i32(&self) -> i32

Source§

fn to_i64(&self) -> i64

Source§

fn to_u8(&self) -> u8

Source§

fn to_u16(&self) -> u16

Source§

fn to_u32(&self) -> u32

Source§

fn to_u64(&self) -> u64

Source§

fn to_i24(&self) -> i24

Source§

fn to_u24(&self) -> u24

Source§

fn as_i24(&self) -> i24

Source§

fn as_u24(&self) -> u24

Source§

fn to_f32(&self) -> f32

Source§

fn to_f64(&self) -> f64

Source§

fn to_longer(&self) -> Self::Longer

Source§

fn to_shorter(&self) -> Self::Shorter

Source§

fn is_signed(&self) -> bool

Source§

fn is_unsigned(&self) -> bool

Source§

fn is_integer(&self) -> bool

Source§

fn is_float(&self) -> bool

Source§

fn to_signed(&self) -> Self::Signed

Source§

fn to_unsigned(&self) -> Self::Unsigned

Source§

fn read_le<T>(r: &mut T) -> Result<Self, Error>
where T: Read + ?Sized,

Source§

fn read_be<T>(r: &mut T) -> Result<Self, Error>
where T: Read + ?Sized,

Source§

fn write_le<T>(&self, w: &mut T) -> Result<(), Error>
where T: Write + ?Sized,

Source§

fn write_be<T>(&self, w: &mut T) -> Result<(), Error>
where T: Write + ?Sized,

Source§

impl SampleType for u8

Source§

type Shorter = u8

Source§

type Longer = u16

Source§

type Signed = i8

Source§

type Unsigned = u8

Source§

fn new() -> Self

Source§

fn from(v: impl SampleType) -> u8

Source§

fn average(s1: u8, s2: u8) -> u8

Source§

fn average_arr(arr: &[Self]) -> Self

Source§

fn to_i8(&self) -> i8

Source§

fn to_i16(&self) -> i16

Source§

fn to_i32(&self) -> i32

Source§

fn to_i64(&self) -> i64

Source§

fn to_u8(&self) -> u8

Source§

fn to_u16(&self) -> u16

Source§

fn to_u32(&self) -> u32

Source§

fn to_u64(&self) -> u64

Source§

fn to_i24(&self) -> i24

Source§

fn to_u24(&self) -> u24

Source§

fn as_i24(&self) -> i24

Source§

fn as_u24(&self) -> u24

Source§

fn to_f32(&self) -> f32

Source§

fn to_f64(&self) -> f64

Source§

fn to_longer(&self) -> Self::Longer

Source§

fn to_shorter(&self) -> Self::Shorter

Source§

fn is_signed(&self) -> bool

Source§

fn is_unsigned(&self) -> bool

Source§

fn is_integer(&self) -> bool

Source§

fn is_float(&self) -> bool

Source§

fn to_signed(&self) -> Self::Signed

Source§

fn to_unsigned(&self) -> Self::Unsigned

Source§

fn read_le<T>(r: &mut T) -> Result<Self, Error>
where T: Read + ?Sized,

Source§

fn read_be<T>(r: &mut T) -> Result<Self, Error>
where T: Read + ?Sized,

Source§

fn write_le<T>(&self, w: &mut T) -> Result<(), Error>
where T: Write + ?Sized,

Source§

fn write_be<T>(&self, w: &mut T) -> Result<(), Error>
where T: Write + ?Sized,

Source§

impl SampleType for u16

Source§

type Shorter = u8

Source§

type Longer = u24

Source§

type Signed = i16

Source§

type Unsigned = u16

Source§

fn new() -> Self

Source§

fn from(v: impl SampleType) -> u16

Source§

fn average(s1: u16, s2: u16) -> u16

Source§

fn average_arr(arr: &[Self]) -> Self

Source§

fn to_i8(&self) -> i8

Source§

fn to_i16(&self) -> i16

Source§

fn to_i32(&self) -> i32

Source§

fn to_i64(&self) -> i64

Source§

fn to_u8(&self) -> u8

Source§

fn to_u16(&self) -> u16

Source§

fn to_u32(&self) -> u32

Source§

fn to_u64(&self) -> u64

Source§

fn to_i24(&self) -> i24

Source§

fn to_u24(&self) -> u24

Source§

fn as_i24(&self) -> i24

Source§

fn as_u24(&self) -> u24

Source§

fn to_f32(&self) -> f32

Source§

fn to_f64(&self) -> f64

Source§

fn to_longer(&self) -> Self::Longer

Source§

fn to_shorter(&self) -> Self::Shorter

Source§

fn is_signed(&self) -> bool

Source§

fn is_unsigned(&self) -> bool

Source§

fn is_integer(&self) -> bool

Source§

fn is_float(&self) -> bool

Source§

fn to_signed(&self) -> Self::Signed

Source§

fn to_unsigned(&self) -> Self::Unsigned

Source§

fn read_le<T>(r: &mut T) -> Result<Self, Error>
where T: Read + ?Sized,

Source§

fn read_be<T>(r: &mut T) -> Result<Self, Error>
where T: Read + ?Sized,

Source§

fn write_le<T>(&self, w: &mut T) -> Result<(), Error>
where T: Write + ?Sized,

Source§

fn write_be<T>(&self, w: &mut T) -> Result<(), Error>
where T: Write + ?Sized,

Source§

impl SampleType for u32

Source§

type Shorter = u24

Source§

type Longer = u64

Source§

type Signed = i32

Source§

type Unsigned = u32

Source§

fn new() -> Self

Source§

fn from(v: impl SampleType) -> u32

Source§

fn average(s1: u32, s2: u32) -> u32

Source§

fn average_arr(arr: &[Self]) -> Self

Source§

fn to_i8(&self) -> i8

Source§

fn to_i16(&self) -> i16

Source§

fn to_i32(&self) -> i32

Source§

fn to_i64(&self) -> i64

Source§

fn to_u8(&self) -> u8

Source§

fn to_u16(&self) -> u16

Source§

fn to_u32(&self) -> u32

Source§

fn to_u64(&self) -> u64

Source§

fn to_i24(&self) -> i24

Source§

fn to_u24(&self) -> u24

Source§

fn as_i24(&self) -> i24

Source§

fn as_u24(&self) -> u24

Source§

fn to_f32(&self) -> f32

Source§

fn to_f64(&self) -> f64

Source§

fn to_longer(&self) -> Self::Longer

Source§

fn to_shorter(&self) -> Self::Shorter

Source§

fn is_signed(&self) -> bool

Source§

fn is_unsigned(&self) -> bool

Source§

fn is_integer(&self) -> bool

Source§

fn is_float(&self) -> bool

Source§

fn to_signed(&self) -> Self::Signed

Source§

fn to_unsigned(&self) -> Self::Unsigned

Source§

fn read_le<T>(r: &mut T) -> Result<Self, Error>
where T: Read + ?Sized,

Source§

fn read_be<T>(r: &mut T) -> Result<Self, Error>
where T: Read + ?Sized,

Source§

fn write_le<T>(&self, w: &mut T) -> Result<(), Error>
where T: Write + ?Sized,

Source§

fn write_be<T>(&self, w: &mut T) -> Result<(), Error>
where T: Write + ?Sized,

Source§

impl SampleType for u64

Source§

type Shorter = u32

Source§

type Longer = u64

Source§

type Signed = i64

Source§

type Unsigned = u64

Source§

fn new() -> Self

Source§

fn from(v: impl SampleType) -> u64

Source§

fn average(s1: u64, s2: u64) -> u64

Source§

fn average_arr(arr: &[Self]) -> Self

Source§

fn to_i8(&self) -> i8

Source§

fn to_i16(&self) -> i16

Source§

fn to_i32(&self) -> i32

Source§

fn to_i64(&self) -> i64

Source§

fn to_u8(&self) -> u8

Source§

fn to_u16(&self) -> u16

Source§

fn to_u32(&self) -> u32

Source§

fn to_u64(&self) -> u64

Source§

fn to_i24(&self) -> i24

Source§

fn to_u24(&self) -> u24

Source§

fn as_i24(&self) -> i24

Source§

fn as_u24(&self) -> u24

Source§

fn to_f32(&self) -> f32

Source§

fn to_f64(&self) -> f64

Source§

fn to_longer(&self) -> Self::Longer

Source§

fn to_shorter(&self) -> Self::Shorter

Source§

fn is_signed(&self) -> bool

Source§

fn is_unsigned(&self) -> bool

Source§

fn is_integer(&self) -> bool

Source§

fn is_float(&self) -> bool

Source§

fn to_signed(&self) -> Self::Signed

Source§

fn to_unsigned(&self) -> Self::Unsigned

Source§

fn read_le<T>(r: &mut T) -> Result<Self, Error>
where T: Read + ?Sized,

Source§

fn read_be<T>(r: &mut T) -> Result<Self, Error>
where T: Read + ?Sized,

Source§

fn write_le<T>(&self, w: &mut T) -> Result<(), Error>
where T: Write + ?Sized,

Source§

fn write_be<T>(&self, w: &mut T) -> Result<(), Error>
where T: Write + ?Sized,

Implementors§