| Crates.io | num-literal-traits |
| lib.rs | num-literal-traits |
| version | 0.1.3 |
| created_at | 2025-09-26 14:27:08.980181+00 |
| updated_at | 2025-10-06 22:41:56.001631+00 |
| description | Convert numerical literals from strings to numbers. |
| homepage | https://github.com/saschaklick/num_literal_traits |
| repository | https://github.com/saschaklick/num_literal_traits |
| max_upload_size | |
| id | 1856006 |
| size | 10,319 |
Add parsing support for numerical literals to integer types.
To use num_literal_traits, first add this to your Cargo.toml:
[dependencies]
num_literal_traits = "0.1.3"
Next, add this to your crate:
use num_literal_traits::NumLiteralTrait
All major C/C++ literal integer formats are supported: 123456, 0x123ABC, 01234567, 0b0101001, as well as ASCII chars: 'A', '@'.
Additionally the numerical parts can include underscores which are removed when parsing: 0b0010_0011_0000_1001.