#conversion #integer #atoi #no-std

no-std btoi

Parse integers directly from ASCII byte slices

10 releases

Uses old Rust 2015

0.4.3 Feb 18, 2023
0.4.2 Feb 16, 2020
0.4.1 Apr 8, 2019
0.4.0 Sep 5, 2018
0.1.2 Nov 29, 2017

#119 in Parser implementations

Download history 119409/week @ 2023-10-20 124938/week @ 2023-10-27 128861/week @ 2023-11-03 136674/week @ 2023-11-10 113012/week @ 2023-11-17 117936/week @ 2023-11-24 116837/week @ 2023-12-01 120828/week @ 2023-12-08 115129/week @ 2023-12-15 90849/week @ 2023-12-22 98094/week @ 2023-12-29 117512/week @ 2024-01-05 117925/week @ 2024-01-12 127555/week @ 2024-01-19 134506/week @ 2024-01-26 123101/week @ 2024-02-02

522,357 downloads per month
Used in 278 crates (24 directly)

MIT/Apache

23KB
300 lines

btoi

Parse integers from ASCII byte slices.

crates.io docs.rs

Introduction

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"));

Documentation

Read the documentation

Changelog

  • 0.4.3
    • Use #[track_caller].
  • 0.4.2
    • No longer !#[deny(warnings)], which is is a forwards compability hazard in libraries.
    • Explicit !#[forbid(unsafe_code)].
  • 0.4.1
    • - was parsed as zero, but should have errored. Thanks @wayslog.
  • 0.4.0
    • Change type of radix to u32 (from u8) to mirror the standard library.
    • No need to #[inline] generic functions.
  • 0.3.0
    • New default feature std. Disable for #![no_std] support.
    • Mark functions as #[inline].
  • 0.2.0
    • No longer reexport num-traits.
  • 0.1.3
    • Update to num-traits 0.2 (semver compatible).
  • 0.1.2
    • Fix documentation warnings.
    • Update dependencies.
  • 0.1.1
    • Documentation fixes.
  • 0.1.0
    • Initial release.

License

btoi is dual licensed under the Apache 2.0 and MIT license, at your option.

Dependencies

~160KB