pub(crate) trait Truncate: Sized {
    // Provided method
    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§

source

fn truncate<To>(self) -> Towhere To: NarrowerThan<Self>,

Implementations on Foreign Types§

source§

impl Truncate for u64

source§

impl Truncate for u16

source§

impl Truncate for u128

source§

impl Truncate for u32

Implementors§