{"id":16697833,"url":"https://github.com/mmstick/numtoa","last_synced_at":"2025-03-21T19:32:23.952Z","repository":{"id":50785003,"uuid":"79002083","full_name":"mmstick/numtoa","owner":"mmstick","description":"An efficient method of heaplessly converting numbers into their string representations, storing the representation within a reusable byte array.","archived":false,"fork":false,"pushed_at":"2021-06-06T09:43:34.000Z","size":50,"stargazers_count":43,"open_issues_count":4,"forks_count":7,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-18T03:56:10.195Z","etag":null,"topics":["algorithm","conversion","integer-conversion","itoa","rust"],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mmstick.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-01-15T05:41:59.000Z","updated_at":"2025-02-12T08:23:36.000Z","dependencies_parsed_at":"2022-08-24T13:38:14.960Z","dependency_job_id":null,"html_url":"https://github.com/mmstick/numtoa","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mmstick%2Fnumtoa","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mmstick%2Fnumtoa/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mmstick%2Fnumtoa/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mmstick%2Fnumtoa/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mmstick","download_url":"https://codeload.github.com/mmstick/numtoa/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244855592,"owners_count":20521666,"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":["algorithm","conversion","integer-conversion","itoa","rust"],"created_at":"2024-10-12T17:49:24.535Z","updated_at":"2025-03-21T19:32:23.620Z","avatar_url":"https://github.com/mmstick.png","language":"Rust","readme":"# NumToA\n\n## `#![no_std]` Compatible with Zero Heap Allocations\n\nThe standard library provides a convenient method of converting numbers into strings, but these strings are\nheap-allocated. If you have an application which needs to convert large volumes of numbers into strings, but don't\nwant to pay the price of heap allocation, this crate provides an efficient `no_std`-compatible method of heaplessly converting numbers\ninto their string representations, storing the representation within a reusable byte array.\n\n## Supports Multiple Bases\n\nIn addition to supporting the standard base 10 conversion, this implementation allows you to select the base of\nyour choice. Therefore, if you want a binary representation, set the base to 2. If you want hexadecimal, set the\nbase to 16.\n\n## `\u0026str` Example\n\n```rust\nuse numtoa::NumToA;\n\nlet mut buffer = [0u8; 20];\nprintln!(\"{}\", 12345.numtoa_str(10, \u0026mut buffer));\nprintln!(\"{}\", 256652.numtoa_str(10, \u0026mut buffer));\n```\n\n## `\u0026[u8]` Example\n\n```rust\nuse numtoa::NumToA;\nuse std::io::{self, Write};\n\nlet stdout = io::stdout();\nlet mut stdout = stdout.lock();\nlet mut buffer = [0u8; 20];\n\nlet number: u32 = 162392;\nlet _ = stdout.write(number.numtoa(10, \u0026mut buffer));\nlet _ = stdout.write(b\"\\n\");\nassert_eq!(number.numtoa(10, \u0026mut buffer), b\"162392\");\n\nlet number: i32 = -6235;\nlet _ = stdout.write(number.numtoa(10, \u0026mut buffer));\nlet _ = stdout.write(b\"\\n\");\n\nlet number: i8 = -128;\nlet _ = stdout.write(number.numtoa(10, \u0026mut buffer));\nlet _ = stdout.write(b\"\\n\");\n\nlet number: i8 = 53;\nlet _ = stdout.write(number.numtoa(10, \u0026mut buffer));\nlet _ = stdout.write(b\"\\n\");\n\nlet number: i16 = -256;\nlet _ = stdout.write(number.numtoa(10, \u0026mut buffer));\nlet _ = stdout.write(b\"\\n\");\n\nlet number: i16 = -32768;\nlet _ = stdout.write(number.numtoa(10, \u0026mut buffer));\nlet _ = stdout.write(b\"\\n\");\n\nlet number: u64 = 35320842;\nlet _ = stdout.write(number.numtoa(10, \u0026mut buffer));\nlet _ = stdout.write(b\"\\n\");\n\nlet number: u64 = 18446744073709551615;\nlet _ = stdout.write(number.numtoa(10, \u0026mut buffer));\nlet _ = stdout.write(b\"\\n\");\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmmstick%2Fnumtoa","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmmstick%2Fnumtoa","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmmstick%2Fnumtoa/lists"}