Skip to main content

Document

Derive Macro Document 

Source
#[derive(Document)]
{
    // Attributes available to this derive:
    #[obj]
}
Expand description

Derive macro for obj::Document.

Emits impl ::obj::Document for <Ident> { ... } with sensible defaults:

  • COLLECTION defaults to the unqualified type name as a string; #[obj(collection = "explicit_name")] overrides.
  • VERSION defaults to 1; #[obj(version = N)] overrides.
  • indexes() is omitted (the trait default Vec::new() is used) when the struct carries no index-related attributes; otherwise the derive emits a Vec<::obj::IndexSpec> in field-declaration order.

All emitted paths are absolute (::obj::Document, ::obj::IndexSpec) so the derive is hygienic against local items that shadow these names.