{"id":33922759,"url":"https://github.com/entropy-tamer/justcode","last_synced_at":"2026-04-10T10:04:12.149Z","repository":{"id":322779477,"uuid":"1090830404","full_name":"entropy-tamer/justcode","owner":"entropy-tamer","description":"Compact binary encoder/decoder with space-efficient encoding scheme","archived":false,"fork":false,"pushed_at":"2025-11-14T20:45:03.000Z","size":55,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-01-02T18:15:04.069Z","etag":null,"topics":["binary","binary-format","bincode","compact","data-structures","decoding","encoding","no-std","rust","serialization","streaming","varint"],"latest_commit_sha":null,"homepage":null,"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/entropy-tamer.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-11-06T07:37:37.000Z","updated_at":"2025-11-14T20:45:07.000Z","dependencies_parsed_at":null,"dependency_job_id":"f4868281-d50b-46c6-b51b-d5f7a6fc1c6b","html_url":"https://github.com/entropy-tamer/justcode","commit_stats":null,"previous_names":["entropy-tamer/justcode"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/entropy-tamer/justcode","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/entropy-tamer%2Fjustcode","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/entropy-tamer%2Fjustcode/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/entropy-tamer%2Fjustcode/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/entropy-tamer%2Fjustcode/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/entropy-tamer","download_url":"https://codeload.github.com/entropy-tamer/justcode/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/entropy-tamer%2Fjustcode/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31637749,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-10T07:40:12.752Z","status":"ssl_error","status_checked_at":"2026-04-10T07:40:11.664Z","response_time":98,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["binary","binary-format","bincode","compact","data-structures","decoding","encoding","no-std","rust","serialization","streaming","varint"],"created_at":"2025-12-12T09:11:37.882Z","updated_at":"2026-04-10T10:04:12.136Z","avatar_url":"https://github.com/entropy-tamer.png","language":"Rust","readme":"# Justcode\n\nA compact binary encoder/decoder with space-efficient encoding scheme. The encoded size will be the same or smaller than the size that the object takes up in memory in a running Rust program.\n\nJustcode is a replacement for bincode, providing similar functionality with a focus on binary encoding without any ideological baggage.\n\n## Features\n\n- **Compact Encoding**: Space-efficient binary encoding that's the same size or smaller than in-memory representation\n- **Varint Encoding**: Variable-length integer encoding for lengths and small values (enabled by default)\n- **Architecture Invariant**: Byte-order independent, works across different architectures\n- **Streaming API**: Reader/Writer API for integration with files, network streams, and compression libraries\n- **Configurable**: Size limits, variable int encoding, and other options\n- **Derive Macros**: Automatic `Encode` and `Decode` trait implementations\n\n## Installation\n\nAdd to your `Cargo.toml`:\n\n```toml\n[dependencies]\njustcode-core = \"0.3.0\"\n```\n\nOr if using from a local path:\n\n```toml\n[dependencies]\njustcode-core = { path = \"../services/justcode/justcode-core\" }\n```\n\nFor derive macros support:\n\n```toml\n[dependencies]\njustcode-core = { version = \"0.3.0\", features = [\"derive\"] }\n# or\njustcode-core = { path = \"../services/justcode/justcode-core\", features = [\"derive\"] }\n```\n\n## Example\n\n```rust\nuse justcode_core::{config, Decode, Encode};\n\n#[derive(Encode, Decode, PartialEq, Debug)]\nstruct Entity {\n    x: f32,\n    y: f32,\n}\n\n#[derive(Encode, Decode, PartialEq, Debug)]\nstruct World(Vec\u003cEntity\u003e);\n\nfn main() {\n    let config = config::standard();\n\n    let world = World(vec![Entity { x: 0.0, y: 4.0 }, Entity { x: 10.0, y: 20.5 }]);\n\n    let encoded: Vec\u003cu8\u003e = justcode_core::encode_to_vec(\u0026world, config).unwrap();\n\n    // The length of the vector is encoded as a varint u64, which in this case is encoded as a single byte\n    // See the documentation on varint for more information.\n    // The 4 floats are encoded in 4 bytes each.\n    assert_eq!(encoded.len(), 1 + 4 * 4);\n\n    let (decoded, len): (World, usize) = justcode_core::decode_from_slice(\u0026encoded[..], config).unwrap();\n\n    assert_eq!(world, decoded);\n    assert_eq!(len, encoded.len()); // read all bytes\n}\n```\n\n## Configuration\n\nJustcode provides a configurable encoding system:\n\n```rust\nuse justcode_core::config;\n\n// Standard configuration (varint encoding enabled, no size limit)\nlet config = config::standard();\n\n// With size limit (recommended for untrusted input)\nlet config = config::standard().with_limit(1024 * 1024); // 1MB limit\n\n// Without variable int encoding (fixed-size integers)\nlet config = config::standard().with_variable_int_encoding(false);\n```\n\n## Supported Types\n\n### Primitives\n\n- All integer types: `u8`, `u16`, `u32`, `u64`, `usize`, `i8`, `i16`, `i32`, `i64`\n- Floating point: `f32`, `f64`\n- Boolean: `bool`\n- Character: `char`\n\n### Collections\n\n- `Vec\u003cT\u003e` where `T: Encode/Decode`\n- `Option\u003cT\u003e` where `T: Encode/Decode`\n- `String` and `\u0026str`\n- Arrays up to 32 elements\n- Tuples up to 4 elements\n\n### Custom Types\n\nUse the derive macros for structs and enums:\n\n```rust\n#[derive(Encode, Decode)]\nstruct MyStruct {\n    field1: u32,\n    field2: String,\n}\n\n#[derive(Encode, Decode)]\nenum MyEnum {\n    Variant1,\n    Variant2(u32),\n    Variant3 { x: f32, y: f32 },\n}\n```\n\n## Enum Encoding\n\nEnums are encoded with a variant index (using varint encoding by default) followed by the variant data. The variant index is determined by the order of variants in the enum definition.\n\n## Reader/Writer API\n\nFor streaming operations:\n\n```rust\nuse justcode_core::{config, writer::Writer, reader::Reader};\n\nlet config = config::standard();\nlet mut writer = Writer::new(config);\nvalue.encode(\u0026mut writer)?;\nlet bytes = writer.into_bytes();\n\nlet mut reader = Reader::new(\u0026bytes, config);\nlet decoded = T::decode(\u0026mut reader)?;\n```\n\n## Testing\n\n### Standard Tests\n\nRun all tests with:\n\n```bash\ncargo test --workspace\n```\n\n### No-Std Tests\n\nTest the no-std code paths separately:\n\n```bash\ncargo test --package justcode-core --test no_std_integration --no-default-features --features derive\n```\n\nThe no-std tests verify that the conditionally compiled Vec implementations work correctly without the `std` feature.\n\n## FAQ\n\n### Is Justcode suitable for storage?\n\nYes, the encoding format is stable when using the same configuration. Justcode is architecture-invariant and space-efficient, making it suitable for storage. However, it does not implement data versioning schemes or file headers.\n\n### Is Justcode suitable for untrusted inputs?\n\nJustcode attempts to protect against hostile data. Use `Config::with_limit()` to set a maximum size limit to prevent memory exhaustion attacks. Deserializing malicious inputs will fail safely without causing undefined behavior.\n\n### What is Justcode's MSRV (minimum supported Rust version)?\n\nJustcode requires Rust 1.70.0 or later.\n\n### Why does justcode not respect `#[repr(u8)]`?\n\nJustcode encodes enum variants using varint encoding (or u32 when variable int encoding is disabled). This ensures compact encoding while maintaining compatibility. If you need to interop with a different protocol, consider implementing `Encode` and `Decode` manually.\n\n## License\n\nMIT\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fentropy-tamer%2Fjustcode","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fentropy-tamer%2Fjustcode","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fentropy-tamer%2Fjustcode/lists"}