Skip to main content

euv_core/component/
impl.rs

1use crate::*;
2
3/// Implementation of ComponentContext construction.
4impl ComponentContext {
5    /// Creates a new empty component context.
6    pub fn new() -> Self {
7        let mut ctx: ComponentContext = ComponentContext::default();
8        ctx.set_hooks(Vec::new());
9        ctx.set_hook_index(0_usize);
10        ctx
11    }
12}
13
14/// Implementation of component context lifecycle and utility methods.
15impl ComponentContext {
16    /// Resets the hook index for a new render cycle.
17    pub fn reset_hook_index(&mut self) {
18        self.set_hook_index(0_usize);
19    }
20}
21
22/// Implementation of ComponentHandle construction.
23impl ComponentHandle {
24    /// Creates a new component handle with the given identifier.
25    pub fn new(id: usize) -> Self {
26        let mut handle: ComponentHandle = ComponentHandle::default();
27        handle.set_id(id);
28        handle
29    }
30}