#conversion #integer #atoi #no-std

no-std btoi

Parse integers directly from ASCII byte slices

9 releases

Uses old Rust 2015

0.4.2 Feb 16, 2020
0.4.1 Apr 8, 2019
0.4.0 Sep 5, 2018
0.3.0 Mar 22, 2018
0.1.2 Nov 29, 2017

#78 in Parser tooling

Download history 586/week @ 2021-10-05 672/week @ 2021-10-12 1017/week @ 2021-10-19 685/week @ 2021-10-26 726/week @ 2021-11-02 445/week @ 2021-11-09 582/week @ 2021-11-16 524/week @ 2021-11-23 678/week @ 2021-11-30 718/week @ 2021-12-07 835/week @ 2021-12-14 494/week @ 2021-12-21 626/week @ 2021-12-28 497/week @ 2022-01-04 754/week @ 2022-01-11 1171/week @ 2022-01-18

3,078 downloads per month
Used in 40 crates (15 directly)

MIT/Apache

21KB
236 lines

btoi

Parse integers from ASCII byte slices.

Build Status 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.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

~140KB