[][src]Trait sp_runtime::traits::CheckedConversion

pub trait CheckedConversion {
    pub fn checked_from<T>(t: T) -> Option<Self>
    where
        Self: TryFrom<T>
, { ... }
pub fn checked_into<T>(self) -> Option<T>
    where
        Self: TryInto<T>
, { ... } }

Convenience type to work around the highly unergonomic syntax needed to invoke the functions of overloaded generic traits, in this case TryFrom and TryInto.

Provided methods

pub fn checked_from<T>(t: T) -> Option<Self> where
    Self: TryFrom<T>, 
[src]

Convert from a value of T into an equivalent instance of Option<Self>.

This just uses TryFrom internally but with this variant you can provide the destination type using turbofish syntax in case Rust happens not to assume the correct type.

pub fn checked_into<T>(self) -> Option<T> where
    Self: TryInto<T>, 
[src]

Consume self to return Some equivalent value of Option<T>.

This just uses TryInto internally but with this variant you can provide the destination type using turbofish syntax in case Rust happens not to assume the correct type.

Loading content...

Implementors

impl<T: Sized> CheckedConversion for T[src]

Loading content...