Trait conv::ConvUtil [] [src]

pub trait ConvUtil {
    fn approx_as<Dst>(self) -> Result<Dst, Self::Err>
    where
        Self: Sized + ApproxInto<Dst>
, { ... } fn approx_as_by<Dst, Scheme>(self) -> Result<Dst, Self::Err>
    where
        Self: Sized + ApproxInto<Dst, Scheme>,
        Scheme: ApproxScheme
, { ... } fn into_as<Dst>(self) -> Dst
    where
        Self: Sized + Into<Dst>
, { ... } fn try_as<Dst>(self) -> Result<Dst, Self::Err>
    where
        Self: Sized + TryInto<Dst>
, { ... } fn value_as<Dst>(self) -> Result<Dst, Self::Err>
    where
        Self: Sized + ValueInto<Dst>
, { ... } }

This extension trait exists to simplify using various conversions.

If there is more than one implementation for a given type/trait pair, a simple call to *_into may not be uniquely resolvable. Due to the position of the type parameter (on the trait itself), it is cumbersome to specify the destination type. A similar problem exists for approximation schemes.

See also the ConvAsUtil trait.

Note: There appears to be a bug in rustdoc's output. This trait is implemented for all types, though the methods are only available for types where the appropriate conversions are defined.

Provided Methods

Approximate the subject to a given type with the default scheme.

Approximate the subject to a given type with a specific scheme.

Convert the subject to a given type.

Attempt to convert the subject to a given type.

Attempt a value conversion of the subject to a given type.

Implementors