pub trait Sample:
Debug
+ Copy
+ Clone
+ Send
+ Sync
+ Add<Output = Self>
+ Sub<Output = Self>
+ Mul<Output = Self>
+ Div<Output = Self>
+ Neg<Output = Self>
+ AddAssign
+ SubAssign
+ MulAssign
+ DivAssign
+ PartialOrd
+ PartialEq
+ 'static {
Show 14 associated constants and 3 methods
const ZERO: Self;
const ONE: Self;
const EPSILON: Self;
const PI: Self;
const INV_PI: Self;
const FRAC_PI_2: Self;
const FRAC_PI_3: Self;
const FRAC_PI_4: Self;
const TAU: Self;
const INV_TAU: Self;
const PHI: Self;
const E: Self;
const SQRT_2: Self;
const INV_SQRT_2: Self;
// Required methods
fn from_f64(value: f64) -> Self;
fn to_f64(self) -> f64;
fn abs(self) -> Self;
}Expand description
A floating-point type suitable for audio sample data.
This trait abstracts over f32 and f64, allowing DSP blocks and graphs
to be generic over sample precision. Use f32 for performance-critical
real-time processing, or f64 when higher precision is required.
When the simd feature is enabled, this trait also provides associated
types and methods for SIMD vectorization.
Required Associated Constants§
Sourceconst EPSILON: Self
const EPSILON: Self
Machine epsilon i.e. the difference between 1.0 and the next larger representable number.
Sourceconst INV_SQRT_2: Self
const INV_SQRT_2: Self
Inverse square root of 2.
Required Methods§
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.