1//! Fast, minimal float-parsing algorithm.
2//!
3//! minimal-lexical has a simple, high-level API with a single
4//! exported function: [`parse_float`].
5//!
6//! [`parse_float`] expects a forward iterator for the integer
7//! and fraction digits, as well as a parsed exponent as an [`i32`].
8//!
9//! For more examples, please see [simple-example](https://github.com/Alexhuszagh/minimal-lexical/blob/master/examples/simple.rs).
10//!
11//! EXAMPLES
12//! --------
13//!
14//! ```
15//! extern crate minimal_lexical;
16//!
17//! // Let's say we want to parse "1.2345".
18//! // First, we need an external parser to extract the integer digits ("1"),
19//! // the fraction digits ("2345"), and then parse the exponent to a 32-bit
20//! // integer (0).
21//! // Warning:
22//! // --------
23//! // Please note that leading zeros must be trimmed from the integer,
24//! // and trailing zeros must be trimmed from the fraction. This cannot
25//! // be handled by minimal-lexical, since we accept iterators.
26//! let integer = b"1";
27//! let fraction = b"2345";
28//! let float: f64 = minimal_lexical::parse_float(integer.iter(), fraction.iter(), 0);
29//! println!("float={:?}", float); // 1.235
30//! ```
31//!
32//! [`parse_float`]: fn.parse_float.html
33//! [`i32`]: https://doc.rust-lang.org/stable/std/primitive.i32.html
34
35// FEATURES
36
37// We want to have the same safety guarantees as Rust core,
38// so we allow unused unsafe to clearly document safety guarantees.
39#![allow(unused_unsafe)]
40#![cfg_attr(feature = "lint", warn(unsafe_op_in_unsafe_fn))]
41#![cfg_attr(not(feature = "std"), no_std)]
42
43#[cfg(all(feature = "alloc", not(feature = "std")))]
44extern crate alloc;
45
46pub mod bellerophon;
47pub mod bigint;
48pub mod extended_float;
49pub mod fpu;
50pub mod heapvec;
51pub mod lemire;
52pub mod libm;
53pub mod mask;
54pub mod num;
55pub mod number;
56pub mod parse;
57pub mod rounding;
58pub mod slow;
59pub mod stackvec;
60pub mod table;
61
62mod table_bellerophon;
63mod table_lemire;
64mod table_small;
65
66// API
67pub use self::num::Float;
68pub use self::parse::parse_float;
69