| Crates.io | btoi |
| lib.rs | btoi |
| version | 0.5.0 |
| created_at | 2017-09-29 17:23:34.685055+00 |
| updated_at | 2025-05-29 09:49:52.808888+00 |
| description | Parse integers directly from ASCII byte slices |
| homepage | |
| repository | https://github.com/niklasf/rust-btoi |
| max_upload_size | |
| id | 33922 |
| size | 42,714 |
Parse integers from ASCII byte slices.
Provides functions similar to from_str_radix,
but is faster when parsing directly from byte slices instead of strings.
Supports #![no_std].
use btoi::btoi;
assert_eq!(Ok(42), btoi(b"42"));
assert_eq!(Ok(-1000), btoi(b"-1000"));
The minimum supported Rust version is 1.60, matching
num_traits,
with no intent to ever increase it.
That's because
#![feature(int_from_ascii)]
in the standard library will hopefully eventually make this crate obsolete
for new versions of Rust, and so old versions are the priority.
ParseIntegerErrorKind via
ParseIntegerError::kind().core::error::Error for ParseIntegerError.#[track_caller].!#[deny(warnings)], which is is a forwards compability hazard
in libraries.!#[forbid(unsafe_code)].- was parsed as zero, but should have errored. Thanks @wayslog.u32 (from u8) to mirror the standard library.#[inline] generic functions.std. Disable for #![no_std] support.#[inline].btoi is dual licensed under the Apache 2.0 and MIT license, at your option.