Skip to main content

euv_core/component/
struct.rs

1use crate::*;
2
3/// Context provided to a component during rendering.
4///
5/// Holds hook state and tracks the current hook index for this render cycle.
6#[derive(Data, Default)]
7pub struct ComponentContext {
8    /// Internal storage for hooks and state.
9    #[get(pub(crate))]
10    #[set(pub(crate))]
11    hooks: Vec<Box<dyn Any>>,
12    /// Current hook index for this render cycle.
13    #[get(pub(crate), type(copy))]
14    #[set(pub(crate))]
15    hook_index: usize,
16}
17
18/// A handle to a mounted component instance.
19///
20/// Uniquely identifies a component instance within the application.
21#[derive(Data, Default, New)]
22pub struct ComponentHandle {
23    /// Unique identifier for this component instance.
24    #[get(pub(crate), type(copy))]
25    #[set(pub(crate))]
26    id: usize,
27}