Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add more const constructors and various convenience functions to Numb…
…er for generic conversions (#47) * Add more const constructors and various convenience functions to Number for generic conversions In particular: - new_u8, new_u16, ..., new_u128 which allow creating an arbitrary int without type conversion, e.g. `u5::new_u32(123)` - new_() which allows any Number argument to be passed through generics - as_() which easily converts any Number to another - as_u8(), as_u16() for more control (and to implement the others) * Fix compile errors * Fix some range checking bugs * Clarify compile time asserts, give them cleaner error messages First step in making .into() more usable * Improve comments; work in new assert_unchecked in the various getters * Add as_usize() * Add inline_const to const_convert_and_const_trait_impl (which is needed only for the old compiler) * Update changelog, bump version * Incorporate naming feedback * Fix test names --------- Co-authored-by: Daniel Lehmann <[email protected]>
- Loading branch information