Trait substrate_fixed::traits::LossyInto
source · pub trait LossyInto<Dst> {
// Required method
fn lossy_into(self) -> Dst;
}
Expand description
This trait provides infallible conversions that might be lossy.
This is the reciprocal of LossyFrom
.
Usually LossyFrom
should be implemented instead of this trait;
there is a blanket implementation which provides this trait when
LossyFrom
is implemented (similar to Into
and From
).
Examples
use substrate_fixed::traits::LossyInto;
use substrate_fixed::types::{I12F4, I4F12};
// original is 0x1.234
let original = I4F12::from_bits(0x1234);
let lossy: I12F4 = original.lossy_into();
assert_eq!(lossy, I12F4::from_bits(0x0012));
Required Methods§
sourcefn lossy_into(self) -> Dst
fn lossy_into(self) -> Dst
Performs the conversion.