{"id":16607974,"url":"https://github.com/alexhuszagh/minimal-lexical","last_synced_at":"2025-05-12T04:30:48.187Z","repository":{"id":38216592,"uuid":"238840454","full_name":"Alexhuszagh/minimal-lexical","owner":"Alexhuszagh","description":"Minimal float parser primitives with a focus on compile times.","archived":false,"fork":false,"pushed_at":"2022-06-08T20:31:15.000Z","size":81359,"stargazers_count":22,"open_issues_count":5,"forks_count":5,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-05-03T03:12:44.904Z","etag":null,"topics":["parser","rust","rustc"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Alexhuszagh.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG","contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-02-07T04:03:55.000Z","updated_at":"2025-02-12T22:29:06.000Z","dependencies_parsed_at":"2022-07-17T08:46:16.156Z","dependency_job_id":null,"html_url":"https://github.com/Alexhuszagh/minimal-lexical","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Alexhuszagh%2Fminimal-lexical","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Alexhuszagh%2Fminimal-lexical/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Alexhuszagh%2Fminimal-lexical/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Alexhuszagh%2Fminimal-lexical/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Alexhuszagh","download_url":"https://codeload.github.com/Alexhuszagh/minimal-lexical/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253675088,"owners_count":21945894,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["parser","rust","rustc"],"created_at":"2024-10-12T01:24:40.749Z","updated_at":"2025-05-12T04:30:43.159Z","avatar_url":"https://github.com/Alexhuszagh.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"minimal-lexical\n===============\n\nThis is a minimal version of [rust-lexical](https://github.com/Alexhuszagh/rust-lexical), meant to allow efficient round-trip float parsing. minimal-lexical implements a correct, fast float parser.\n\nDue to the small, stable nature of minimal-lexical, it is also well-adapted to private forks. If you do privately fork minimal-lexical, I recommend you contact me via [email](mailto:ahuszagh@gmail.com) or [Twitter](https://twitter.com/KardOnIce), so I can notify you of feature updates, bug fixes, or security vulnerabilities, as well as help you implement custom feature requests. I will not use your information for any other purpose, including, but not limited to disclosing your project or organization's use of minimal-lexical.\n\nminimal-lexical is designed for fast compile times and small binaries sizes, at the expense of a minor amount of performance. For improved performance, feel free to fork minimal-lexical with more aggressive inlining.\n\n**Similar Projects**\n\nFor a high-level, all-in-one number conversion routines, see [rust-lexical](https://github.com/Alexhuszagh/rust-lexical).\n\n**Table Of Contents**\n\n- [Getting Started](#getting-started)\n- [Recipes](#recipes)\n- [Algorithms](#algorithms)\n- [Platform Support](platform-support)\n- [Minimum Version Support](minimum-version-support)\n- [Changelog](#changelog)\n- [License](#license)\n- [Contributing](#contributing)\n\n# Getting Started\n\nFirst, add the following to your `Cargo.toml`.\n\n```toml\n[dependencies]\nminimal-lexical = \"0.2\"\n```\n\nNext, to parse a simple float, use the following:\n\n```rust\nextern crate minimal_lexical;\n\n// Let's say we want to parse \"1.2345\".\n// First, we need an external parser to extract the integer digits (\"1\"),\n// the fraction digits (\"2345\"), and then parse the exponent to a 32-bit\n// integer (0). \n// Warning:\n// --------\n//  Please note that leading zeros must be trimmed from the integer,\n//  and trailing zeros must be trimmed from the fraction. This cannot\n//  be handled by minimal-lexical, since we accept iterators\nlet integer = b\"1\";\nlet fraction = b\"2345\";\nlet float: f64 = minimal_lexical::parse_float(integer.iter(), fraction.iter(), 0);\nprintln!(\"float={:?}\", float);    // 1.235\n```\n\n# Recipes\n\nYou may be asking: where is the actual parser? Due to variation in float formats, and the goal of integrating utility for various data-interchange language parsers, such functionality would be beyond the scope of this library.\n\nFor example, the following float is valid in Rust strings, but is invalid in JSON or TOML:\n```json\n1.e7\n```\n\nTherefore, to use the library, you need functionality that extracts the significant digits to pass to `create_float`. Please see [simple-example](https://github.com/Alexhuszagh/minimal-lexical/blob/master/examples/simple.rs) for a simple, annotated example on how to use minimal-lexical as a parser.\n\n# Algorithms\n\nFor an in-depth explanation on the algorithms minimal-lexical uses, please see [lexical-core#string-to-float](https://github.com/Alexhuszagh/rust-lexical/tree/master/lexical-core#string-to-float).\n\n# Platform Support\n\nminimal-lexical is tested on a wide variety of platforms, including big and small-endian systems, to ensure portable code. Supported architectures include:\n- x86_64 Linux, Windows, macOS, Android, iOS, FreeBSD, and NetBSD.\n- x86 Linux, macOS, Android, iOS, and FreeBSD.\n- aarch64 (ARM8v8-A) Linux, Android, and iOS.\n- armv7 (ARMv7-A) Linux, Android, and iOS.\n- arm (ARMv6) Linux, and Android.\n- mips (MIPS) Linux.\n- mipsel (MIPS LE) Linux.\n- mips64 (MIPS64 BE) Linux.\n- mips64el (MIPS64 LE) Linux.\n- powerpc (PowerPC) Linux.\n- powerpc64 (PPC64) Linux.\n- powerpc64le (PPC64LE) Linux.\n- s390x (IBM Z) Linux.\n\nminimal-lexical should also work on a wide variety of other architectures and ISAs. If you have any issue compiling minimal-lexical on any architecture, please file a bug report.\n\n# Minimum Version Support\n\nMinimal-lexical is tested to support Rustc 1.36+, including stable, beta, and nightly. Please report any errors compiling a supported lexical version on a compatible Rustc version. Please note we may increment the MSRV for compiler versions older than 18 months, to support at least the current Debian stable version, without breaking changes.\n\n# Changelog\n\nAll changes are documented in [CHANGELOG](CHANGELOG).\n\n# License\n\nMinimal-lexical is dual licensed under the Apache 2.0 license as well as the MIT license. See the [LICENSE.md](LICENSE.md) file for full license details.\n\n# Contributing\n\nUnless you explicitly state otherwise, any contribution intentionally submitted for inclusion in minimal-lexical by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexhuszagh%2Fminimal-lexical","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falexhuszagh%2Fminimal-lexical","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexhuszagh%2Fminimal-lexical/lists"}