ailloli_ui_runtime/component/
props.rs

1//! Marker contract for owned declarative component properties.
2
3/// Cloneable `'static` properties accepted by component nodes.
4///
5/// A blanket implementation covers every `Clone + 'static` type, so callers
6/// should not write a manual implementation. The `'static` bound excludes props
7/// that borrow short-lived stack data; use owned values or reference-counted
8/// handles instead.
9///
10/// # Examples
11///
12/// ```
13/// use ailloli_ui_runtime::component::Props;
14/// #[derive(Clone)]
15/// struct LabelProps { text: String }
16/// fn accepts_props<P: Props>(props: P) -> P { props }
17/// let props = accepts_props(LabelProps { text: "hello".into() });
18/// assert_eq!(props.text, "hello");
19/// ```
20pub trait Props: Clone + 'static {}
21
22/// Implements the Props contract for T where T: Clone + 'static.
23impl<T> Props for T where T: Clone + 'static {}