macro_rules! renderer {
($slice:path, $backend:ty, kind: $kind:expr, props: $props:ty, patch: $patch:ty,
make: $make:expr, update: $update:expr, measure: $measure:expr $(,)?) => { ... };
($slice:path, $backend:ty, kind: $kind:expr, props: $props:ty, patch: $patch:ty,
make: $make:expr, update: $update:expr $(,)?) => { ... };
($slice:path, $backend:ty, kind: $kind:expr, props: $props:ty,
make: $make:expr, measure: $measure:expr $(,)?) => { ... };
($slice:path, $backend:ty, kind: $kind:expr, props: $props:ty, make: $make:expr $(,)?) => { ... };
}Expand description
Register a piece’s per-toolkit native renderer into $slice (a backend’s RENDERERS).
The author writes typed functions and one macro line — no #[distributed_slice], no Renderer {}
literal, no downcast_ref in the bodies:
ⓘ
fn make(b: &mut AppKit, p: &MyProps, id: NodeId) -> Retained<NSView> { … }
fn update(b: &mut AppKit, h: &Retained<NSView>, patch: &MyPatch) { … }
day_pieces::renderer!(day_appkit::RENDERERS, AppKit,
kind: KIND, props: MyProps, patch: MyPatch, make: make, update: update);Add measure: f (e.g. measure: day_pieces::fill_measure) for custom sizing; omit it to use the
backend’s default. One renderer! per module (it defines a module-level static).