pub trait MIDINumFrom<T: MIDINum> {
// Required method
fn midi_num_from(val: T) -> Self;
}
Required Methods§
Sourcefn midi_num_from(val: T) -> Self
fn midi_num_from(val: T) -> Self
Casts the midi time type to another supported type.
By default, supports: i32, i64, u32, u64, f32, f64
§Example
use midi_toolkit::num::{MIDINumInto};
let dt_i32: i32 = 10;
let dt_u64: u64 = 10;
let dt_f32: f32 = dt_i32.midi_num_into();
let dt_f64: f64 = dt_i32.midi_num_into();
let dt_u32: u32 = dt_u64.midi_num_into();
let dt_i64: i64 = dt_u64.midi_num_into();
assert_eq!(dt_f32, 10f32);
assert_eq!(dt_f64, 10f64);
assert_eq!(dt_u32, 10u32);
assert_eq!(dt_i64, 10i64);
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.