{"id":33933172,"url":"https://github.com/brickadia-community/brickadia-rs","last_synced_at":"2026-04-02T02:18:03.728Z","repository":{"id":39898549,"uuid":"384816571","full_name":"brickadia-community/brickadia-rs","owner":"brickadia-community","description":"Reader/writer for BRS files in Rust","archived":false,"fork":false,"pushed_at":"2024-02-26T23:44:11.000Z","size":361,"stargazers_count":5,"open_issues_count":0,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-09-26T03:02:53.761Z","etag":null,"topics":["library","save-reader","save-writer"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/brickadia-community.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2021-07-10T23:18:34.000Z","updated_at":"2025-07-14T05:01:05.000Z","dependencies_parsed_at":"2024-02-27T00:36:52.974Z","dependency_job_id":"997ccc37-dd2d-42b0-8e74-083598417b3b","html_url":"https://github.com/brickadia-community/brickadia-rs","commit_stats":{"total_commits":51,"total_committers":4,"mean_commits":12.75,"dds":0.196078431372549,"last_synced_commit":"15239d0924fa71f19f3babe70db559b6698335ad"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/brickadia-community/brickadia-rs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brickadia-community%2Fbrickadia-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brickadia-community%2Fbrickadia-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brickadia-community%2Fbrickadia-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brickadia-community%2Fbrickadia-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/brickadia-community","download_url":"https://codeload.github.com/brickadia-community/brickadia-rs/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brickadia-community%2Fbrickadia-rs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31294509,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-02T01:43:37.129Z","status":"online","status_checked_at":"2026-04-02T02:00:08.535Z","response_time":89,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["library","save-reader","save-writer"],"created_at":"2025-12-12T13:02:50.064Z","updated_at":"2026-04-02T02:18:03.717Z","avatar_url":"https://github.com/brickadia-community.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# brickadia-rs\n\nA Brickadia save file (.brs) reader/writer library for Rust.\n\nSupports save versions \u003c= 10.\n\n### Features\n\nThis library serves as a replacement for the officially supported [brs](https://github.com/brickadia/brs)\nlibrary, which at the time of writing can only read/write saves \u003c= version 4.\n\n`brickadia-rs` currently supports missing features from `brs` like save previews, components, brick owners,\nand so on. It will also be maintained as the `.brs` spec continues to change in the future.\n\n#### Serde support\n\nBy using the optional feature `serialize`, you can seamlessly serialize/deserialize into/from the\n[brs-js](https://github.com/brickadia-community/brs-js) JSON spec.\n\n#### Compression backends\n\nBy default, `brickadia-rs` uses [`flate2`](https://crates.io/crates/flate2)'s default compression backend,\n`miniz_oxide`, which has the benefit of being pure Rust. If you are looking for extra performance, use\nthe `zlib-ng` feature of this crate to use that backend instead:\n\n```toml\nbrickadia = { version = \"0.1\", default_features = false, features = [\"util\", \"zlib-ng\"] }\n```\n\n#### Util module\n\nThe optional feature `util` includes some utilities like getting brick size from brick asset, handling with\nrotations and orientations, and so on. It is enabled by default. To disable it, use `default_features = false`\nin your `Cargo.toml` dependency for `brickadia`, e.g. `brickadia = { version = \"0.1\", default_features = false }`.\n\n#### Octree module\n\nIncluded in the `util` module is a module named `octree`, which adds an octree constructor and traversal object\nyou can wrap around your `SaveData` that will allow you to quickly traverse through bricks in space. Here is\nsome example usage:\n\n```rs\n// ... assume we have a `SaveData` named `save`\nlet octree = SaveOctree::new(save); // or `save.into_octree();`\n\n// find the first brick that has a color of (0, 0) in the palette\nlet base_brick = octree.data().bricks.iter().find(|b| b.color == BrickColor::Index(0)).unwrap();\n\n// fetch a list of bricks above it\nlet bricks_above = octree.brick_side(base_brick, Direction::ZPositive);\n```\n\n## Installation\n\nAdd the following to your `Cargo.toml`'s dependencies:\n\n```toml\nbrickadia = \"0.1\"\n```\n\n## Usage\n\n### Reading\n\nBelow will read the file `my_brs_file.brs` and display brick count, map, and list each brick's position.\n\n```rs\nuse std::fs;\n\nuse brickadia::read::SaveReader;\n\nfn main() {\n    let mut reader = SaveReader::new(fs::File::open(\"my_brs_file.brs\").unwrap()).unwrap();\n    let save = reader.read_all().unwrap();\n\n    println!(\"Brick count: {}\", save.header1.brick_count);\n    println!(\"Map: {}\", save.header1.map);\n\n    for brick in save.bricks.iter() {\n        println!(\"There's a brick at {}.\", brick.position);\n    }\n}\n```\n\n### Writing\n\nBelow will create a 10x10 grid of bricks and save to `brickadia-rs.brs`.\n\n```rs\nuse std::{env, fs::File};\n\nuse brickadia::{\n    save::{Brick, BrickColor, BrickOwner, Color, Preview, SaveData, Size, User},\n    write::SaveWriter,\n};\n\nfn main() {\n    let me = User {\n        name: \"x\".into(),\n        id: \"3f5108a0-c929-4e77-a115-21f65096887b\".parse().unwrap(),\n    };\n\n    let mut save = SaveData::default();\n\n    // set the first header\n    save.header1.author = me.clone();\n    save.header1.host = Some(me.clone());\n    save.header1.description = \"This was saved with brickadia-rs!\".into();\n\n    // set the second header\n    save.header2\n        .brick_owners\n        .push(BrickOwner::from_user_bricks(me.clone(), 100));\n\n    // set the preview image\n    let preview_bytes = std::fs::read(\"examples/write_preview.png\").unwrap();\n    save.preview = Preview::PNG(preview_bytes);\n\n    // add some bricks\n    for y in 0..10 {\n        for x in 0..10 {\n            let mut brick = Brick::default();\n            brick.position = (x * 10, y * 10, 10);\n            brick.size = Size::Procedural(5, 5, 6);\n            brick.color = BrickColor::Unique(Color {\n                r: (x as f32 / 10.0 * 255.0) as u8,\n                g: 255,\n                b: (y as f32 / 10.0 * 255.0) as u8,\n                a: 255,\n            });\n            save.bricks.push(brick);\n        }\n    }\n\n    // write out the save\n    let save_location = env::args()\n        .nth(1)\n        .unwrap_or(\"examples/write.out.brs\".into());\n    SaveWriter::new(File::create(save_location).unwrap(), save)\n        .write()\n        .unwrap();\n\n    println!(\"Save written\");\n}\n```\n\n## Credits\n\n* [voximity](https://github.com/voximity) - creator, maintainer\n* [Meshiest](https://github.com/Meshiest) - [brs-js](https://github.com/brickadia-community/brs-js) reference, octree implementation from JS\n* [qoh](https://github.com/qoh) - [brs](https://github.com/brickadia/brs), original library\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrickadia-community%2Fbrickadia-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbrickadia-community%2Fbrickadia-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrickadia-community%2Fbrickadia-rs/lists"}