pub trait CastFrom<S>: Sized {
// Required method
fn cast_from(value: S) -> Self;
}Expand description
Performs a raw numeric cast from type S into Self.
Unlike ConvertTo and ConvertFrom, casts apply standard numeric
conversion rules equivalent to an as expression — no audio-aware
scaling, rounding, or saturation is applied. This trait is used
internally to move values between numeric types for arithmetic or
indexing purposes.
For audio-meaningful conversions (e.g. i16 → f32 in the range
[-1.0, 1.0]), use ConvertTo or ConvertFrom instead.
Required Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".