Trait conv::TryFrom [] [src]

pub trait TryFrom<Src>: Sized {
    type Err;
    fn try_from(src: Src) -> Result<Self, Self::Err>;
}

This trait is used to perform a conversion between different semantic types which might fail.

Details

Typically, this should be used in cases where you are converting between values whose ranges and/or representations only partially overlap. That the conversion may fail should be a reasonably expected outcome. A standard example of this is converting from integers to enums of unitary variants.

Associated Types

type Err

The error type produced by a failed conversion.

Required Methods

fn try_from(src: Src) -> Result<Self, Self::Err>

Convert the given value into the subject type.

Implementors