pub struct ComponentContext<'a> {
pub component_id: String,
pub surface_id: String,
pub data_context: DataContext<'a>,
pub components: &'a SurfaceComponentsModel,
pub focused_id: Option<String>,
pub template_index: Option<usize>,
}Expand description
Transient context created for each component during rendering.
The caller is responsible for holding the RefCell borrows on DataModel and SurfaceComponentsModel for the duration of rendering.
Fields§
§component_id: StringThe component’s ID.
surface_id: StringThe surface ID this component belongs to.
data_context: DataContext<'a>Scoped data access for resolving dynamic values.
components: &'a SurfaceComponentsModelThe components model (escape hatch for inspecting siblings/children).
focused_id: Option<String>The ID of the currently focused component, if any.
template_index: Option<usize>The index of this component within a template iteration, if applicable.
Implementations§
Source§impl<'a> ComponentContext<'a>
impl<'a> ComponentContext<'a>
Sourcepub fn new(
component_id: String,
surface_id: String,
data_model: &'a DataModel,
components: &'a SurfaceComponentsModel,
functions: &'a HashMap<String, Box<dyn FunctionImplementation>>,
base_path: &str,
focused_id: Option<String>,
) -> Self
pub fn new( component_id: String, surface_id: String, data_model: &'a DataModel, components: &'a SurfaceComponentsModel, functions: &'a HashMap<String, Box<dyn FunctionImplementation>>, base_path: &str, focused_id: Option<String>, ) -> Self
Create a component context.
Callers should borrow surface.data_model and surface.components
before calling this and pass the references.
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for ComponentContext<'a>
impl<'a> !UnwindSafe for ComponentContext<'a>
impl<'a> Freeze for ComponentContext<'a>
impl<'a> Send for ComponentContext<'a>
impl<'a> Sync for ComponentContext<'a>
impl<'a> Unpin for ComponentContext<'a>
impl<'a> UnsafeUnpin for ComponentContext<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more