Skip to main content

ToU16

Trait ToU16 

Source
pub trait ToU16: CastInto<Self::Output> {
    type Output;

    // Required methods
    fn to_u16(self) -> Self::Output;
    fn to_u16_range(self) -> Self::Output;
}
Expand description

Helper trait based on CastInto and CastRangeInto Also work on composite like std::array, [Vector]…

Required Associated Types§

Required Methods§

Source

fn to_u16(self) -> Self::Output

Same semantics as the as keyword: 4f32 as u64, and the From trait, but generic friendly.

Like the as keyword, the result might lose some precision.

Source

fn to_u16_range(self) -> Self::Output

Remap the value RangeDefault to the RangeDefault of the target type, in a generic friendly way, and similar to the From trait.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl ToU16 for bool

Source§

impl ToU16 for f32

Source§

impl ToU16 for f64

Source§

impl ToU16 for i8

Source§

impl ToU16 for i16

Source§

impl ToU16 for i32

Source§

impl ToU16 for i64

Source§

impl ToU16 for isize

Source§

impl ToU16 for u8

Source§

impl ToU16 for u16

Source§

impl ToU16 for u32

Source§

impl ToU16 for u64

Source§

impl ToU16 for usize

Implementors§

Source§

impl<S> ToU16 for S
where S: Map + CastInto<<S as Map>::WithType<<<S as MapIntern>::Item as ToU16>::Output>>, <S as MapIntern>::Item: ToU16,

Source§

type Output = <S as Map>::WithType<<<S as MapIntern>::Item as ToU16>::Output>