Skip to main content

ToI8

Trait ToI8 

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

    // Required methods
    fn to_i8(self) -> Self::Output;
    fn to_i8_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_i8(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_i8_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 ToI8 for bool

Source§

impl ToI8 for f32

Source§

type Output = i8

Source§

fn to_i8(self) -> <f32 as ToI8>::Output

Source§

fn to_i8_range(self) -> <f32 as ToI8>::Output

Source§

impl ToI8 for f64

Source§

type Output = i8

Source§

fn to_i8(self) -> <f64 as ToI8>::Output

Source§

fn to_i8_range(self) -> <f64 as ToI8>::Output

Source§

impl ToI8 for i8

Source§

type Output = i8

Source§

fn to_i8(self) -> <i8 as ToI8>::Output

Source§

fn to_i8_range(self) -> <i8 as ToI8>::Output

Source§

impl ToI8 for i16

Source§

type Output = i8

Source§

fn to_i8(self) -> <i16 as ToI8>::Output

Source§

fn to_i8_range(self) -> <i16 as ToI8>::Output

Source§

impl ToI8 for i32

Source§

type Output = i8

Source§

fn to_i8(self) -> <i32 as ToI8>::Output

Source§

fn to_i8_range(self) -> <i32 as ToI8>::Output

Source§

impl ToI8 for i64

Source§

type Output = i8

Source§

fn to_i8(self) -> <i64 as ToI8>::Output

Source§

fn to_i8_range(self) -> <i64 as ToI8>::Output

Source§

impl ToI8 for isize

Source§

impl ToI8 for u8

Source§

type Output = i8

Source§

fn to_i8(self) -> <u8 as ToI8>::Output

Source§

fn to_i8_range(self) -> <u8 as ToI8>::Output

Source§

impl ToI8 for u16

Source§

type Output = i8

Source§

fn to_i8(self) -> <u16 as ToI8>::Output

Source§

fn to_i8_range(self) -> <u16 as ToI8>::Output

Source§

impl ToI8 for u32

Source§

type Output = i8

Source§

fn to_i8(self) -> <u32 as ToI8>::Output

Source§

fn to_i8_range(self) -> <u32 as ToI8>::Output

Source§

impl ToI8 for u64

Source§

type Output = i8

Source§

fn to_i8(self) -> <u64 as ToI8>::Output

Source§

fn to_i8_range(self) -> <u64 as ToI8>::Output

Source§

impl ToI8 for usize

Implementors§

Source§

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

Source§

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