Trait sp_runtime::traits::SaturatedConversion

source ·
pub trait SaturatedConversion {
    // Provided methods
    fn saturated_from<T>(t: T) -> Self
       where Self: UniqueSaturatedFrom<T> { ... }
    fn saturated_into<T>(self) -> T
       where Self: UniqueSaturatedInto<T> { ... }
}
Expand description

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

Provided Methods§

source

fn saturated_from<T>(t: T) -> Self
where Self: UniqueSaturatedFrom<T>,

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

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

source

fn saturated_into<T>(self) -> T
where Self: UniqueSaturatedInto<T>,

Consume self to return an equivalent value of T.

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

Implementors§