rust-ux / uX

Non standard integer types like `u7`, `u9`, `u10`, `u63`, `i7`, `i9`
Apache License 2.0
121 stars 37 forks source link

Converting to usize/isize? #47

Open tobiasvl opened 2 years ago

tobiasvl commented 2 years ago

I'm not a Rust veteran, but is there a (fixable) reason why the ux types can't be converted directly to usize/isize?

let x = usize::from(u4::new(0)); // the trait bound `usize: std::convert::From<ux::u4>` is not satisfied
let x = usize::from(u8::from(u4::new(0))); // works, but is obviously not ergonomical
tobiasvl commented 2 years ago

Ah... Seems that would be fixed by #22