Skip to main content

Crate automorph_derive

Crate automorph_derive 

Source
Expand description

Derive macro for the Automorph trait.

This crate provides #[derive(Automorph)] to automatically implement bidirectional synchronization with Automerge documents.

§Supported Structures

  • Named structs: struct Foo { bar: i32 }
  • Tuple structs (newtype): struct Foo(Bar)
  • Unit structs: struct Foo
  • Enums with all variant types

§Container Attributes

  • #[automorph(rename_all = "...")] - Rename all fields (camelCase, snake_case, etc.)
  • #[automorph(tag = "...")] - Internal tagging for enums
  • #[automorph(tag = "...", content = "...")] - Adjacent tagging for enums
  • #[automorph(untagged)] - Untagged enum representation

§Field Attributes

  • #[automorph(rename = "...")] - Rename this field
  • #[automorph(skip)] - Skip this field entirely
  • #[automorph(default)] - Use Default if field is missing

Derive Macros§

Automorph
Derive the Automorph trait for a struct or enum.