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§
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>
fn read_be<T>(r: &mut T) -> Result<Self, Error>
fn write_le<T>(&self, w: &mut T) -> Result<(), Error>
fn write_be<T>(&self, w: &mut T) -> Result<(), Error>
Provided Methods§
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.