Skip to main content

Crate kael_macros

Crate kael_macros 

Source
Expand description

§kael-macros

Procedural macros behind Kael’s action, element, context, style, inspection, and deterministic-test APIs.

Applications should normally depend on kael, which re-exports the application-facing macros with the runtime traits and types they generate code against. Direct use of this crate is mainly useful for framework integrators.

The application-facing entry points are:

  • #[derive(Action)], #[derive(IntoElement)], #[derive(AppContext)], and #[derive(VisualContext)];
  • #[kael::test] for deterministic framework tests;
  • register_action! for manually implemented action types.

Action names are application protocol keys. The derive rejects empty, oversized, control-character, and whitespace-padded names, as well as duplicate deprecated aliases. Context derives require exactly one argument-free #[app] or #[window] marker on a named field. Deterministic tests require at least one iteration.

The remaining style and inspector macros generate Kael’s own builder and reflection APIs. Most applications use the generated methods through kael::Styled instead of invoking those macros directly.

See the Kael guide and kael-macros API documentation for the complete macro reference.

§License

Licensed under the Apache License, Version 2.0.

Macros§

border_style_methods
Generates methods for border styles.
box_shadow_style_methods
Generates methods for box shadow styles.
cursor_style_methods
Generates methods for cursor styles.
margin_style_methods
Generates methods for margin styles.
overflow_style_methods
Generates methods for overflow styles.
padding_style_methods
Generates methods for padding styles.
position_style_methods
Generates methods for position styles.
register_action
Registers an action with the Kael runtime when you manually implement the Action trait. Typically you should use the Action derive macro or actions! macro instead.
visibility_style_methods
Generates methods for visibility styles.

Attribute Macros§

derive_inspector_reflection
When added to a trait, #[derive_inspector_reflection] generates a module which provides enumeration and lookup by name of all methods that have the shape fn method(self) -> Self. This is used by the inspector so that it can use the builder methods in Styled and StyledExt.
test
#[kael::test] annotates test functions that run with Kael support.

Derive Macros§

Action
Derives Kael’s Action protocol implementation for a concrete type.
AppContext
Derives AppContext for a type that holds a &mut App.
IntoElement
Derives IntoElement for a type that implements RenderOnce.
VisualContext
Derives VisualContext for an AppContext that also holds a &mut Window.