{"id":19035825,"url":"https://github.com/adinack/tiny-serde","last_synced_at":"2025-04-17T14:33:26.096Z","repository":{"id":206887793,"uuid":"717909507","full_name":"AdinAck/tiny-serde","owner":"AdinAck","description":"A statically determined serialization and deserialization system for sized types.","archived":true,"fork":false,"pushed_at":"2024-01-16T03:47:47.000Z","size":21,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-21T21:38:37.426Z","etag":null,"topics":["embedded-rust","no-std","serialization"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AdinAck.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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-11-13T00:17:41.000Z","updated_at":"2024-08-18T03:17:09.000Z","dependencies_parsed_at":"2023-11-26T04:19:22.060Z","dependency_job_id":"af41b79a-351d-43d5-a90b-35fc441f2b60","html_url":"https://github.com/AdinAck/tiny-serde","commit_stats":null,"previous_names":["adinack/tiny-serde"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AdinAck%2Ftiny-serde","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AdinAck%2Ftiny-serde/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AdinAck%2Ftiny-serde/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AdinAck%2Ftiny-serde/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AdinAck","download_url":"https://codeload.github.com/AdinAck/tiny-serde/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249348704,"owners_count":21255307,"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":["embedded-rust","no-std","serialization"],"created_at":"2024-11-08T21:52:16.669Z","updated_at":"2025-04-17T14:33:25.838Z","avatar_url":"https://github.com/AdinAck.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# tiny-serde\n\nA statically determined serialization and deserialization system for sized types.\n\n## no_std\n\nThis crate is intended for use in `no_std` environments.\n\n# Usage\n\nThis crate creates two traits: `Serialize` and `Deserialize`.\n\nThey are extremely simple:\n\n```rust\npub trait Serialize\u003cconst N: usize\u003e: Sized {\n    fn serialize(self) -\u003e [u8; N];\n}\n```\n\n```rust\npub trait Deserialize\u003cconst N: usize\u003e: Sized {\n    fn deserialize(data: [u8; N]) -\u003e Option\u003cSelf\u003e;\n}\n```\n\nAs you can see, since these traits are restricted to sized types, the size of the serialized representation (`N`) is known as well.\n\nTwo convenience derive macros `Serialize` and `Deserialize` are provided and can be used like so:\n\n```rust\n#[derive(Serialize, Deserialize)]\n#[repr(u16)]\nenum Foo {\n    A,\n    B(bool) = 0xde,\n    C(u8)\n}\n\n#[derive(Serialize, Deserialize)]\nstruct Bar {\n    a: u8,\n    foo: Foo,\n    b: u16\n}\n```\n\n\u003e Since `Foo` implements `Serialize` and `Deserialize`, `Bar` can as well.\n\n# Design Considerations\n\n## Safety\n\nNo `unsafe` blocks are used in this crate. The derive macros cannot generate unsafe code. Worst case their output will just not compile.\n\n## Note\n\nThe derive macros are a **zero-cost abstraction**. They employ constant evaluation to generate static code that extracts bytes from inner structures and places it into the result array. No counting pointer, no runtime checks (other than that of `array::copy_from_slice(...)`), direct insertion only.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadinack%2Ftiny-serde","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadinack%2Ftiny-serde","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadinack%2Ftiny-serde/lists"}