0.1.0 |
|
---|
#10 in #u256
42KB
1K
SLoC
UN-PRIM
Unusual primitive types for any rust project.
This crate was unstable and maybe lot's of bugs and I suggest not to use this.
[dependencies]
unprim = "0.1"
use unprim::*;
let x: U256 = 100u128.into();
let y: U256 = 2u128.into();
let z = x * y;
assert_eq!(200u64, z.into());
TODO
- Add Pow/Exp method for each types.
- Add SQRT method for each types.
lib.rs
:
unprim contains primitive types from 8 into 256 bit. it is unstable and not intended for production use.
use unprim::*;
let a = U8::from(100);
let b = U8::from(2);
assert_eq!(a * b, 200u64.into());
Or you can use .into()
method to init the types.
use unprim::*;
let a: U8 = 100u64.into();
let b: U8 = 2u64.into();
let c: u32 = (a * b).into();
assert_eq!(c, 200);