Trait sampara::sample::conv::ConvertInto [−][src]
Required methods
fn convert_into(self) -> S
[src]
Convert Self
into another Sample
type. This is analogous
to std::convert::Into
, but is intended for preserving the same
represented amplitude between sample types.
This trait has a blanket implementation for all types that implement
ConvertFrom
.
use sampara::{Sample, ConvertInto}; fn main() { let s: i8 = 0.0f32.convert_into(); assert_eq!(s, 0); let s: u8 = 0.0f32.convert_into(); assert_eq!(s, 128); let s: f32 = 255u8.convert_into(); assert_eq!(s, 0.9921875); }
Implementors
impl<T, U> ConvertInto<U> for T where
T: Sample,
U: ConvertFrom<T> + Sample,
[src]
T: Sample,
U: ConvertFrom<T> + Sample,