cast

Trait From

Source
pub trait From<Src> {
    type Output;

    // Required method
    fn cast(_: Src) -> Self::Output;
}
Expand description

The “cast from” operation

Required Associated Types§

Source

type Output

The result of the cast operation: either Self or Result<Self, Error>

Required Methods§

Source

fn cast(_: Src) -> Self::Output

Checked cast from Src to Self

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 From<f32> for f32

Source§

impl From<f32> for f64

Source§

impl From<f32> for i8

Source§

type Output = Result<i8, Error>

Source§

fn cast(src: f32) -> Self::Output

Source§

impl From<f32> for i16

Source§

impl From<f32> for i32

Source§

impl From<f32> for i64

Source§

impl From<f32> for isize

Source§

impl From<f32> for u8

Source§

type Output = Result<u8, Error>

Source§

fn cast(src: f32) -> Self::Output

Source§

impl From<f32> for u16

Source§

impl From<f32> for u32

Source§

impl From<f32> for u64

Source§

impl From<f32> for usize

Source§

impl From<f64> for f32

Source§

impl From<f64> for f64

Source§

impl From<f64> for i8

Source§

type Output = Result<i8, Error>

Source§

fn cast(src: f64) -> Self::Output

Source§

impl From<f64> for i16

Source§

impl From<f64> for i32

Source§

impl From<f64> for i64

Source§

impl From<f64> for isize

Source§

impl From<f64> for u8

Source§

type Output = Result<u8, Error>

Source§

fn cast(src: f64) -> Self::Output

Source§

impl From<f64> for u16

Source§

impl From<f64> for u32

Source§

impl From<f64> for u64

Source§

impl From<f64> for usize

Source§

impl From<i8> for f32

Source§

impl From<i8> for f64

Source§

impl From<i8> for i8

Source§

type Output = i8

Source§

fn cast(src: i8) -> i8

Source§

impl From<i8> for i16

Source§

impl From<i8> for i32

Source§

impl From<i8> for i64

Source§

impl From<i8> for isize

Source§

impl From<i8> for u8

Source§

type Output = Result<u8, Error>

Source§

fn cast(src: i8) -> Self::Output

Source§

impl From<i8> for u16

Source§

type Output = Result<u16, Error>

Source§

fn cast(src: i8) -> Self::Output

Source§

impl From<i8> for u32

Source§

type Output = Result<u32, Error>

Source§

fn cast(src: i8) -> Self::Output

Source§

impl From<i8> for u64

Source§

type Output = Result<u64, Error>

Source§

fn cast(src: i8) -> Self::Output

Source§

impl From<i8> for usize

Source§

impl From<i16> for f32

Source§

impl From<i16> for f64

Source§

impl From<i16> for i8

Source§

type Output = Result<i8, Error>

Source§

fn cast(src: i16) -> Self::Output

Source§

impl From<i16> for i16

Source§

impl From<i16> for i32

Source§

impl From<i16> for i64

Source§

impl From<i16> for isize

Source§

impl From<i16> for u8

Source§

type Output = Result<u8, Error>

Source§

fn cast(src: i16) -> Self::Output

Source§

impl From<i16> for u16

Source§

impl From<i16> for u32

Source§

impl From<i16> for u64

Source§

impl From<i16> for usize

Source§

impl From<i32> for f32

Source§

impl From<i32> for f64

Source§

impl From<i32> for i8

Source§

type Output = Result<i8, Error>

Source§

fn cast(src: i32) -> Self::Output

Source§

impl From<i32> for i16

Source§

impl From<i32> for i32

Source§

impl From<i32> for i64

Source§

impl From<i32> for isize

Source§

impl From<i32> for u8

Source§

type Output = Result<u8, Error>

Source§

fn cast(src: i32) -> Self::Output

Source§

impl From<i32> for u16

Source§

impl From<i32> for u32

Source§

impl From<i32> for u64

Source§

impl From<i32> for usize

Source§

impl From<i64> for f32

Source§

impl From<i64> for f64

Source§

impl From<i64> for i8

Source§

type Output = Result<i8, Error>

Source§

fn cast(src: i64) -> Self::Output

Source§

impl From<i64> for i16

Source§

impl From<i64> for i32

Source§

impl From<i64> for i64

Source§

impl From<i64> for isize

Source§

impl From<i64> for u8

Source§

type Output = Result<u8, Error>

Source§

fn cast(src: i64) -> Self::Output

Source§

impl From<i64> for u16

Source§

impl From<i64> for u32

Source§

impl From<i64> for u64

Source§

impl From<i64> for usize

Source§

impl From<isize> for f32

Source§

impl From<isize> for f64

Source§

impl From<isize> for i8

Source§

impl From<isize> for i16

Source§

impl From<isize> for i32

Source§

impl From<isize> for i64

Source§

impl From<isize> for isize

Source§

impl From<isize> for u8

Source§

impl From<isize> for u16

Source§

impl From<isize> for u32

Source§

impl From<isize> for u64

Source§

impl From<isize> for usize

Source§

impl From<u8> for f32

Source§

impl From<u8> for f64

Source§

impl From<u8> for i8

Source§

type Output = Result<i8, Error>

Source§

fn cast(src: u8) -> Self::Output

Source§

impl From<u8> for i16

Source§

impl From<u8> for i32

Source§

impl From<u8> for i64

Source§

impl From<u8> for isize

Source§

impl From<u8> for u8

Source§

type Output = u8

Source§

fn cast(src: u8) -> u8

Source§

impl From<u8> for u16

Source§

impl From<u8> for u32

Source§

impl From<u8> for u64

Source§

impl From<u8> for usize

Source§

impl From<u16> for f32

Source§

impl From<u16> for f64

Source§

impl From<u16> for i8

Source§

type Output = Result<i8, Error>

Source§

fn cast(src: u16) -> Self::Output

Source§

impl From<u16> for i16

Source§

impl From<u16> for i32

Source§

impl From<u16> for i64

Source§

impl From<u16> for isize

Source§

impl From<u16> for u8

Source§

type Output = Result<u8, Error>

Source§

fn cast(src: u16) -> Self::Output

Source§

impl From<u16> for u16

Source§

impl From<u16> for u32

Source§

impl From<u16> for u64

Source§

impl From<u16> for usize

Source§

impl From<u32> for f32

Source§

impl From<u32> for f64

Source§

impl From<u32> for i8

Source§

type Output = Result<i8, Error>

Source§

fn cast(src: u32) -> Self::Output

Source§

impl From<u32> for i16

Source§

impl From<u32> for i32

Source§

impl From<u32> for i64

Source§

impl From<u32> for isize

Source§

impl From<u32> for u8

Source§

type Output = Result<u8, Error>

Source§

fn cast(src: u32) -> Self::Output

Source§

impl From<u32> for u16

Source§

impl From<u32> for u32

Source§

impl From<u32> for u64

Source§

impl From<u32> for usize

Source§

impl From<u64> for f32

Source§

impl From<u64> for f64

Source§

impl From<u64> for i8

Source§

type Output = Result<i8, Error>

Source§

fn cast(src: u64) -> Self::Output

Source§

impl From<u64> for i16

Source§

impl From<u64> for i32

Source§

impl From<u64> for i64

Source§

impl From<u64> for isize

Source§

impl From<u64> for u8

Source§

type Output = Result<u8, Error>

Source§

fn cast(src: u64) -> Self::Output

Source§

impl From<u64> for u16

Source§

impl From<u64> for u32

Source§

impl From<u64> for u64

Source§

impl From<u64> for usize

Source§

impl From<usize> for f32

Source§

impl From<usize> for f64

Source§

impl From<usize> for i8

Source§

impl From<usize> for i16

Source§

impl From<usize> for i32

Source§

impl From<usize> for i64

Source§

impl From<usize> for isize

Source§

impl From<usize> for u8

Source§

impl From<usize> for u16

Source§

impl From<usize> for u32

Source§

impl From<usize> for u64

Source§

impl From<usize> for usize

Implementors§