Trait 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 fixed::traits::LossyInto;
use fixed::types::{I12F4, I8F24};
// original is 0x12.345678, lossy is 0x012.3
let original = I8F24::from_bits(0x1234_5678);
let lossy: I12F4 = original.lossy_into();
assert_eq!(lossy, I12F4::from_bits(0x0123));

Required Methods§

source

fn lossy_into(self) -> Dst

Performs the conversion.

Implementors§

source§

impl<Src, Dst> LossyInto<Dst> for Src
where Dst: LossyFrom<Src>,