{"id":16948129,"url":"https://github.com/dentosal/pinecone","last_synced_at":"2025-04-11T20:11:52.778Z","repository":{"id":57655319,"uuid":"223691246","full_name":"Dentosal/pinecone","owner":"Dentosal","description":"Minimalistic serde format supporting no_std + alloc","archived":false,"fork":false,"pushed_at":"2022-01-05T07:44:32.000Z","size":111,"stargazers_count":5,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-11T20:11:47.926Z","etag":null,"topics":[],"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/Dentosal.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}},"created_at":"2019-11-24T04:17:22.000Z","updated_at":"2023-06-28T15:25:45.000Z","dependencies_parsed_at":"2022-09-01T01:40:40.395Z","dependency_job_id":null,"html_url":"https://github.com/Dentosal/pinecone","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dentosal%2Fpinecone","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dentosal%2Fpinecone/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dentosal%2Fpinecone/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dentosal%2Fpinecone/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Dentosal","download_url":"https://codeload.github.com/Dentosal/pinecone/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248473129,"owners_count":21109628,"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-10-13T21:49:43.244Z","updated_at":"2025-04-11T20:11:52.745Z","avatar_url":"https://github.com/Dentosal.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Pinecone - Yet another binary format for Serde\n\nPinecone is a minimalistic `no_std` + `alloc` fork of [Postcard](https://github.com/jamesmunns/postcard).\n\n* [Documentation](https://docs.rs/pinecone/)\n* [Crates.io](https://crates.io/crates/pinecone)\n\n## Features\n\nPinecone always assumes that deserialization target is correct.\nIt is fully possible to deserialize into an incorrect type.\nHowever, this requires less space and is faster to decode.\n\n## Usage\n\nWorks just like any other normal serde:\n\n```rust\nuse pinecone::{from_bytes, to_slice, to_vec};\nuse serde::{Deserialize, Serialize};\n\n#[derive(Debug, PartialEq, Eq, Serialize, Deserialize)]\nstruct Example {\n    foo: String,\n    bar: Option\u003cu32\u003e,\n    zot: bool,\n}\n\nfn main() {\n    let original = Example {\n        foo: \"Vec test\".to_string(),\n        bar: Some(0x1337),\n        zot: true,\n    };\n\n    let bytes: Vec\u003cu8\u003e = to_vec(\u0026original).expect(\"Serialization failed\");\n    assert_eq!(from_bytes(\u0026bytes), Ok(original));\n\n    let original = Example {\n        foo: \"Slice test\".to_string(),\n        bar: Some(0x1337),\n        zot: true,\n    };\n\n    let mut buffer = [0; 1024];\n    to_slice(\u0026original, \u0026mut buffer).expect(\"Serialization failed\");\n    assert_eq!(from_bytes(\u0026buffer), Ok(original));\n}\n```\n\n## Variable Length Data\n\nVariable length data (such as slices) are prefixed by their length.\n\nLength is encoded as a [Varint]. This is done for two reasons: to minimize wasted bytes\non the wire when sending slices with items less than 127 items (typical for embedded),\nand to reduce compatibility issues between 32-bit and 64-bit targets due to differing sizes\nof `usize`.\n\nSimilarly, `enum` descriminants are encoded as varints, meaning that any enum with less than\n127 variants will encode its discriminant as a single byte (rather than a `u32`).\n\nVarints in `pinecone` have a maximum value of the usize for that platform. In practice, this\nmeans that 64-bit targets should not send messages with slices containing `(1 \u003c\u003c 32) - 1` items\nto 32-bit targets, which is uncommon in practice. Enum discriminants already have a fixed\nmaximum value of `(1 \u003c\u003c 32) - 1` as currently defined in Rust. Varints larger than the current platform's\n`usize` will cause the deserialization process to return an `Err`.\n\n[Varint]: https://developers.google.com/protocol-buffers/docs/encoding\n\n## License\n\nLicensed under either of\n\n- Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or\n  http://www.apache.org/licenses/LICENSE-2.0)\n- MIT license ([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%2Fdentosal%2Fpinecone","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdentosal%2Fpinecone","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdentosal%2Fpinecone/lists"}