pub trait ToUsize {
// Required method
fn to_usize(self) -> usize;
}Expand description
Infallibly convert a value into usize.
Implementations exist only when the conversion is guaranteed not
to lose information under the selected min-usize-* portability
contract.
use usize_conv::ToUsize;
let x: u16 = 5;
assert_eq!(x.to_usize(), 5usize);