pub trait OneWay {
type Source;
type Dest;
// Required method
fn one_way(src: Self::Source) -> Result<Self::Dest>;
}Expand description
A trait for 1-way conversions between numeric types that may fail.
Provides basically the same functionality as std::convert::TryFrom
from std, but a new trait was needed in order to implement it for
conversions such as f64 to u32, or
num_complex::Complex32 to f32.
See also the conv crate, which was
also considered but cannot be used here because it is not compatible
with num_complex::Complex32.
Required Associated Types§
Required Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".