Skip to main content

Crate horizon_lattice_macros

Crate horizon_lattice_macros 

Source
Expand description

Procedural macros for Horizon Lattice meta-object system.

This crate provides the #[derive(Object)] macro and related attribute macros for defining signals, properties, and slots.

§Attributes

§#[property]

Marks a field as a property with optional change notification:

#[derive(Object)]
struct Counter {
    base: ObjectBase,

    #[property(notify = "value_changed")]
    value: Property<i32>,

    #[property(read_only)]
    computed: i32,

    #[signal]
    value_changed: Signal<i32>,
}

Property attributes:

  • notify = "signal_name": Links the property to a change notification signal
  • read_only: Makes the property read-only (no setter generated)
  • skip: Excludes the field from meta-object registration

§#[signal]

Marks a field as a signal:

#[signal]
clicked: Signal<()>,

#[signal]
text_changed: Signal<String>,

§#[object]

Struct-level attribute for object configuration:

#[derive(Object)]
#[object(no_factory)]  // Don't generate factory function
struct MyWidget {
    // ...
}

Derive Macros§

Object
Derive the Object trait and generate meta-object information.