Skip to main content

ToU8

Trait ToU8 

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

    // Required methods
    fn to_u8(self) -> Self::Output;
    fn to_u8_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_u8(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_u8_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", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl ToU8 for bool

Source§

impl ToU8 for f32

Source§

type Output = u8

Source§

fn to_u8(self) -> <f32 as ToU8>::Output

Source§

fn to_u8_range(self) -> <f32 as ToU8>::Output

Source§

impl ToU8 for f64

Source§

type Output = u8

Source§

fn to_u8(self) -> <f64 as ToU8>::Output

Source§

fn to_u8_range(self) -> <f64 as ToU8>::Output

Source§

impl ToU8 for i8

Source§

type Output = u8

Source§

fn to_u8(self) -> <i8 as ToU8>::Output

Source§

fn to_u8_range(self) -> <i8 as ToU8>::Output

Source§

impl ToU8 for i16

Source§

type Output = u8

Source§

fn to_u8(self) -> <i16 as ToU8>::Output

Source§

fn to_u8_range(self) -> <i16 as ToU8>::Output

Source§

impl ToU8 for i32

Source§

type Output = u8

Source§

fn to_u8(self) -> <i32 as ToU8>::Output

Source§

fn to_u8_range(self) -> <i32 as ToU8>::Output

Source§

impl ToU8 for i64

Source§

type Output = u8

Source§

fn to_u8(self) -> <i64 as ToU8>::Output

Source§

fn to_u8_range(self) -> <i64 as ToU8>::Output

Source§

impl ToU8 for isize

Source§

impl ToU8 for u8

Source§

type Output = u8

Source§

fn to_u8(self) -> <u8 as ToU8>::Output

Source§

fn to_u8_range(self) -> <u8 as ToU8>::Output

Source§

impl ToU8 for u16

Source§

type Output = u8

Source§

fn to_u8(self) -> <u16 as ToU8>::Output

Source§

fn to_u8_range(self) -> <u16 as ToU8>::Output

Source§

impl ToU8 for u32

Source§

type Output = u8

Source§

fn to_u8(self) -> <u32 as ToU8>::Output

Source§

fn to_u8_range(self) -> <u32 as ToU8>::Output

Source§

impl ToU8 for u64

Source§

type Output = u8

Source§

fn to_u8(self) -> <u64 as ToU8>::Output

Source§

fn to_u8_range(self) -> <u64 as ToU8>::Output

Source§

impl ToU8 for usize

Implementors§

Source§

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

Source§

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