{"id":23129789,"url":"https://github.com/detro/bytes_parser","last_synced_at":"2025-09-01T20:11:49.594Z","repository":{"id":65192671,"uuid":"584228447","full_name":"detro/bytes_parser","owner":"detro","description":"A simple wrapper to parse primitive Rust types from a slice of bytes.","archived":false,"fork":false,"pushed_at":"2024-05-20T07:58:11.000Z","size":30,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-08-15T14:28:38.843Z","etag":null,"topics":["bytes","parser","primitive-types","rust","rust-library","scalar-types","simple","wrapper"],"latest_commit_sha":null,"homepage":"https://crates.io/crates/bytes_parser","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/detro.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-01-01T23:06:46.000Z","updated_at":"2024-05-20T07:58:15.000Z","dependencies_parsed_at":"2024-12-17T10:11:03.428Z","dependency_job_id":"a64fcf66-ebb5-4336-b09d-c76a457a981b","html_url":"https://github.com/detro/bytes_parser","commit_stats":{"total_commits":36,"total_committers":1,"mean_commits":36.0,"dds":0.0,"last_synced_commit":"6652af692388e2b86356d7c0aaadb0f090be90c5"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/detro/bytes_parser","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/detro%2Fbytes_parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/detro%2Fbytes_parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/detro%2Fbytes_parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/detro%2Fbytes_parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/detro","download_url":"https://codeload.github.com/detro/bytes_parser/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/detro%2Fbytes_parser/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273183228,"owners_count":25059812,"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","status":"online","status_checked_at":"2025-09-01T02:00:09.058Z","response_time":120,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["bytes","parser","primitive-types","rust","rust-library","scalar-types","simple","wrapper"],"created_at":"2024-12-17T10:10:53.563Z","updated_at":"2025-09-01T20:11:49.538Z","avatar_url":"https://github.com/detro.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# bytes_parser [![CI_s]][CI_l] [![Doc_s]][Doc_l] [![Ver_s]][Ver_l] [![Down_s]][Down_l] ![Lic_s]\n\n[CI_s]: https://img.shields.io/github/actions/workflow/status/detro/bytes_parser/ci.yml?branch=main\u0026label=CI\u0026logo=Github\u0026style=flat-square\n[CI_l]: https://github.com/detro/bytes_parser/actions/workflows/ci.yml\n[Down_s]: https://img.shields.io/crates/d/bytes_parser?logo=rust\u0026style=flat-square\u0026label=DOWN\n[Down_l]: https://crates.io/crates/bytes_parser\n[Ver_s]: https://img.shields.io/crates/v/bytes_parser?logo=rust\u0026style=flat-square\u0026label=VER\n[Ver_l]: https://crates.io/crates/bytes_parser/versions\n[Doc_s]: https://img.shields.io/docsrs/bytes_parser?logo=rust\u0026style=flat-square\u0026label=DOC\n[Doc_l]: https://docs.rs/bytes_parser/latest/bytes_parser/\n[Lic_s]: https://img.shields.io/crates/l/bytes_parser?style=flat-square\u0026label=L\n\n***A simple wrapper to parse primitive Rust types from a slice of bytes `[u8]`***\n\n---\n\n## What is it for?\n\nThis is the crate for you, if all you need is to parse a **bespoke binary protocol**.\nYou provide a reference slice of bytes, and assuming you know what those bytes represent,\nread the original values out of it.\n\nThe core of this crate is `BytesParser`, built with few principles in mind:\n\n* **simplicity:** just a _thin wrapper_ around an array of bytes,\n  with a cursor to track progress.\n* **zero-copy:** all you get back is either a bit-copied primitive,\n  or a reference backed by the original bytes - never cloning.\n* **only primitive types**: if you need to serialize/deserialize complex data structures,\n  you probably want [serde](https://crates.io/crates/serde).\n\n## Features\n\n* Parse all primitive\n  [scalar types](https://doc.rust-lang.org/book/ch03-02-data-types.html#scalar-types),\n  signed and unsigned, as well as `\u0026str` and sub-slice of `\u0026[u8]`.\n* Internal, auto-updating cursor, to implement a simple scanning logic.\n* Options to move the cursor arbitrarily, but safely, along the input slice.\n* Support for [Endianness](https://en.wikipedia.org/wiki/Endianness)\n  selection (see `ParsingEndian`).\n* Descriptive errors (see `BytesParserError`).\n* Minimal dependencies.\n\n## Examples\n\n```rust\nuse bytes_parser::{BytesParser, ParsingEndian};\n\nlet input: \u0026[u8] = /* a slice of bytes from somewhere */;\n\n// Crate a parser from a given slice of bytes\nlet mut parser = BytesParser::from(input);\n\n// Will use Big-Endian parsing\nassert_eq!(parser.endian(), ParsingEndian::BE);\nassert_eq!(ParsingEndian::BE, ParsingEndian::default());\n\n// Parse a string length and the string itself\nlet str_len = parser.parse_usize()?;\nlet str = parser.parse_str_utf8(str_len)?;\nassert_eq!(str, \"Forza Napoli Sempre!\");\n```\n\n## Alternatives\n\n* [nom](https://crates.io/crates/nom): steeper learning curve, but more feature complete.\n* [serde](https://crates.io/crates/serde): mostly focused on SERialization/DEserialization of well known formats,\n  but it can be setup to handle a slice of bytes.\n\n## License\n\nLicensed under either of\n\n* Apache License, Version 2.0\n  ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)\n* MIT license\n  ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)\n\nat your option.\n\n## Contribution\n\nUnless you explicitly state otherwise, any contribution intentionally submitted\nfor inclusion in the work by you, as defined in the Apache-2.0 license, shall be\ndual licensed as above, without any additional terms or conditions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdetro%2Fbytes_parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdetro%2Fbytes_parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdetro%2Fbytes_parser/lists"}