explicit_cast

Crates.ioexplicit_cast
lib.rsexplicit_cast
version1.0.0
sourcesrc
created_at2023-12-07 00:38:31.09947
updated_at2023-12-07 00:38:31.09947
descriptionA crate for explicit widening, truncating, and sign casting of primitive integers
homepagehttps://github.com/ultrabear/explicit_cast
repositoryhttps://github.com/ultrabear/explicit_cast
max_upload_size
id1060562
size22,229
Alex H (ultrabear)

documentation

README

explicit_cast

A crate for explicitly widening, truncating, and sign casting integers.
This crate is very simple, but the functionality it provides is universal, as such, it is distributed under Apache-2.0 OR MIT.

Usage

use explict_cast::prelude::*;

let my_value: u8 = u16::MAX.truncate();
let next: i16 = my_value.widen().sign_cast();

assert_eq!(next, 0xffi16);
Commit count: 3

cargo fmt