{"id":13423325,"url":"https://github.com/xoac/static-bytes","last_synced_at":"2025-04-09T21:33:27.154Z","repository":{"id":55323797,"uuid":"290621757","full_name":"xoac/static-bytes","owner":"xoac","description":"Fixed-size bytes wrapper prevents panic. Implement `bytes::BufMut`","archived":false,"fork":false,"pushed_at":"2021-01-05T15:19:20.000Z","size":34,"stargazers_count":7,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-23T23:27:02.281Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/xoac.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":"2020-08-26T22:54:57.000Z","updated_at":"2025-03-09T16:23:03.000Z","dependencies_parsed_at":"2022-08-14T21:10:16.247Z","dependency_job_id":null,"html_url":"https://github.com/xoac/static-bytes","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xoac%2Fstatic-bytes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xoac%2Fstatic-bytes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xoac%2Fstatic-bytes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xoac%2Fstatic-bytes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xoac","download_url":"https://codeload.github.com/xoac/static-bytes/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248115012,"owners_count":21050154,"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":[],"created_at":"2024-07-31T00:00:30.895Z","updated_at":"2025-04-09T21:33:27.126Z","avatar_url":"https://github.com/xoac.png","language":"Rust","readme":"[![crates.io](https://img.shields.io/crates/v/static-bytes.svg)](https://crates.io/crates/static-bytes)\n[![Documentation](https://docs.rs/static-bytes/badge.svg)](https://docs.rs/static-bytes/)\n[![CI master](https://github.com/xoac/static-bytes/workflows/Continuous%20integration/badge.svg?branch=master)](https://github.com/xoac/static-bytes/actions?query=workflow%3A%22Continuous+integration%22)\n![Maintenance](https://img.shields.io/badge/maintenance-experimental-blue.svg)\n\n# static-bytes\n\nThe aim of this crate is to improve user experience when working with static bytes.\nLook at this pseudo code example to understand problem with `\u0026mut [u8]` and `bytes::buf::BufMut`\n```compile_fail\nlet mut fixed_storage = [u8; 16];\nlet mut slice = fixed_storage[..];\nlet len_before = slice.len();\n// declaration fn encode(\u0026self, buf: \u0026mut dyn BufMut);\nframe.encode(\u0026mut slice);\nlet len = len_before - slice.len();\nlet filled_bytes = fixed_storage[..len];\n```\nThere are two problems with code above:\n- it will panic if encode want to use more than 16 bytes!\n- it is boilerplate\n\nYou can resolve both with `SafeBytesSlice`. For example usage see\n[docs](https://docs.rs/static-bytes/0.2/static_bytes/struct.SafeBytesSlice.html).\n\n### Compatibility with bytes\n- v0.1.x is compatible with bytes \u003e=0.5.0, \u003c0.6.0\n- v0.2.x is compatible with bytes \u003e=0.6.0, \u003c0.7.0\n- v0.3.x is compatible with bytes \u003e=0.1.0, \u003c2.0.0\n\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\nThis project try follow rules:\n* [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),\n* [Semantic Versioning](https://semver.org/spec/v2.0.0.html).\n\n_This README was generated with [cargo-readme](https://github.com/livioribeiro/cargo-readme) from [template](https://github.com/xoac/crates-io-lib-template)_\n","funding_links":[],"categories":["no-std crates"],"sub_categories":["WIP"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxoac%2Fstatic-bytes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxoac%2Fstatic-bytes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxoac%2Fstatic-bytes/lists"}