| Crates.io | parcode-derive |
| lib.rs | parcode-derive |
| version | 0.4.0 |
| created_at | 2025-12-10 06:59:39.214019+00 |
| updated_at | 2025-12-17 16:52:27.882116+00 |
| description | Procedural macros for the Parcode high-performance serialization library. |
| homepage | |
| repository | https://github.com/retypeos/parcode |
| max_upload_size | |
| id | 1977616 |
| size | 33,276 |
This crate provides the #[derive(ParcodeObject)] procedural macro for the Parcode library.
Note: You likely do not need to add this crate directly to your
Cargo.toml. Instead, use theparcodecrate which re-exports this macro.
Deriving ParcodeObject on a struct automatically implements:
MyStructLazy) for zero-copy field access.use parcode::ParcodeObject;
use serde::{Serialize, Deserialize};
#[derive(Serialize, Deserialize, ParcodeObject)]
struct Level {
// Local fields (stored in the main payload)
id: u32,
name: String,
// Chunkable fields (stored in separate shards for parallel access)
#[parcode(chunkable)]
geometry: Vec<u8>,
// Optimized Map (O(1) random access via hashing)
#[parcode(map)]
users: std::collections::HashMap<u64, String>,
// Custom compression per field
#[parcode(chunkable, compression = "lz4")]
assets: Vec<u8>,
}
#[parcode(chunkable)]: Marks a field (usually a Vec or nested Struct) to be stored in its own graph node. This enables lazy loading and parallel writing for this field.#[parcode(map)]: Activates "Hash Sharding" for HashMap types. This splits the map into buckets and builds micro-indexes, allowing $O(1)$ lookup without deserializing the whole map.#[parcode(compression = "...")]: Overrides the compression algorithm for this specific field. Supported values: "none", "lz4".This project is licensed under the MIT license.