pub(crate) trait Truncate: Sized {
    fn truncate<To>(self) -> To
   where
        To: NarrowerThan<Self>
, { ... } }
Expand description

Replacement for as casts going from wide integer to narrower integer.

Example

let x = 99_u64;
let lo = x.truncate::<u16>();
// lo is of type u16, equivalent to `x as u16`.

Provided Methods

Implementations on Foreign Types

Implementors