Skip to main content

Convert

Trait Convert 

Source
pub trait Convert<Input> {
    type Output;
    type Error;

    // Required method
    fn try_convert(&mut self, input: Input) -> Result<Self::Output, Self::Error>;
}
Expand description

Fallible conversion from one type to another.

Required Associated Types§

Source

type Output

Converted type if the conversion succeeds.

Source

type Error

Error type if the conversion fails

Required Methods§

Source

fn try_convert(&mut self, input: Input) -> Result<Self::Output, Self::Error>

Try to convert an instance of the input type to the output type. The conversion may fail, in which case an error is returned.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§