{"id":46963356,"url":"https://github.com/rlch/lorosurgeon","last_synced_at":"2026-03-11T10:01:19.877Z","repository":{"id":343459818,"uuid":"1177804036","full_name":"rlch/lorosurgeon","owner":"rlch","description":"Autosurgeon-style derive macros for Loro CRDT containers","archived":false,"fork":false,"pushed_at":"2026-03-10T14:31:42.000Z","size":116,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-03-10T19:10:01.986Z","etag":null,"topics":[],"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/rlch.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,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-03-10T11:43:53.000Z","updated_at":"2026-03-10T14:31:20.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/rlch/lorosurgeon","commit_stats":null,"previous_names":["rlch/lorosurgeon"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/rlch/lorosurgeon","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rlch%2Florosurgeon","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rlch%2Florosurgeon/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rlch%2Florosurgeon/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rlch%2Florosurgeon/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rlch","download_url":"https://codeload.github.com/rlch/lorosurgeon/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rlch%2Florosurgeon/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30377837,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-11T06:09:32.197Z","status":"ssl_error","status_checked_at":"2026-03-11T06:09:17.086Z","response_time":84,"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":[],"created_at":"2026-03-11T10:00:35.088Z","updated_at":"2026-03-11T10:01:19.869Z","avatar_url":"https://github.com/rlch.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# lorosurgeon\n\n[![Crates.io](https://img.shields.io/crates/v/lorosurgeon.svg)](https://crates.io/crates/lorosurgeon)\n[![docs.rs](https://docs.rs/lorosurgeon/badge.svg)](https://docs.rs/lorosurgeon)\n[![CI](https://github.com/rlch/lorosurgeon/actions/workflows/ci.yml/badge.svg)](https://github.com/rlch/lorosurgeon/actions/workflows/ci.yml)\n[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)\n\nDerive macros for bidirectional serialization between Rust types and [Loro](https://loro.dev) CRDT containers — the Loro equivalent of [autosurgeon](https://github.com/automerge/autosurgeon) for Automerge.\n\n`#[derive(Hydrate, Reconcile)]` generates field-level mapping between Rust types and Loro containers. Only modified fields produce CRDT operations.\n\n## Quick Start\n\n```rust\nuse loro::LoroDoc;\nuse lorosurgeon::{Hydrate, Reconcile, DocSync};\n\n#[derive(Debug, PartialEq, Hydrate, Reconcile)]\n#[loro(root = \"config\")]\nstruct Config {\n    name: String,\n    version: i64,\n    position: Position,\n}\n\n#[derive(Debug, PartialEq, Hydrate, Reconcile)]\nstruct Position { x: f64, y: f64 }\n\nlet doc = LoroDoc::new();\nlet config = Config {\n    name: \"hello\".into(),\n    version: 1,\n    position: Position { x: 10.0, y: 20.0 },\n};\n\nconfig.to_doc(\u0026doc).unwrap();  // Rust → Loro\ndoc.commit();\n\nlet loaded = Config::from_doc(\u0026doc).unwrap();  // Loro → Rust\nassert_eq!(loaded, config);\n```\n\n## Documentation\n\n**[Full API documentation on docs.rs →](https://docs.rs/lorosurgeon)**\n\nThe crate docs include type mapping tables, attribute reference, examples for concurrent editing, custom serialization, flatten, keyed list diffing, and more.\n\n## Features\n\n- **Structs** → `LoroMap` (fields become keys)\n- **Enums** → `LoroMap` with variant discriminator, unit variants as strings\n- **`Vec\u003cT\u003e`** → `LoroList` with Myers LCS diffing\n- **`#[loro(movable)]`** → `LoroMovableList` with identity-preserving `mov()`/`set()`\n- **`HashMap\u003cString, V\u003e`** → `LoroMap` with stale-key cleanup\n- **`#[loro(text)]`** → `LoroText` with character-level diffing (on `String` fields)\n- **No-op detection** — identical values produce zero CRDT operations\n- **Concurrent merge** — field-level granularity means independent edits compose\n\n## Attributes\n\n```rust\n// Container-level\n#[loro(root = \"key\")]          // DocSync: to_doc() / from_doc()\n\n// Field-level\n#[key]                         // Identity key for movable list diffing\n#[loro(rename = \"name\")]       // Different key in Loro\n#[loro(json)]                  // serde_json round-trip\n#[loro(text)]                  // LoroText with character-level LCS\n#[loro(movable)]               // LoroMovableList instead of LoroList\n#[loro(default)]               // Default::default() when absent\n#[loro(default = \"fn\")]        // Custom default function\n#[loro(flatten)]               // Inline nested struct fields\n#[loro(with = \"module\")]       // Custom hydrate + reconcile\n#[loro(hydrate = \"fn\")]        // Custom hydrate only\n#[loro(reconcile = \"fn\")]      // Custom reconcile only\n```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frlch%2Florosurgeon","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frlch%2Florosurgeon","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frlch%2Florosurgeon/lists"}