Trait pax_kit::pax_runtime::ComponentFactory

source ·
pub trait ComponentFactory {
    // Required methods
    fn build_default_properties(
        &self,
    ) -> Box<dyn Fn(Rc<RuntimePropertiesStackFrame>, Option<Rc<ExpandedNode>>) -> Option<Rc<RefCell<PaxAny>>>>;
    fn build_inline_properties(
        &self,
        defined_properties: BTreeMap<String, ValueDefinition>,
    ) -> Box<dyn Fn(Rc<RuntimePropertiesStackFrame>, Option<Rc<ExpandedNode>>) -> Option<Rc<RefCell<PaxAny>>>>;
    fn build_handler(
        &self,
        fn_name: &str,
    ) -> fn(_: Rc<RefCell<PaxAny>>, _: &NodeContext, _: Option<PaxAny>);
    fn build_component_handlers(
        &self,
        handlers: Vec<(String, Vec<String>)>,
    ) -> Rc<RefCell<HandlerRegistry>>;
    fn add_inline_handlers(
        &self,
        handlers: Vec<(String, String)>,
        registry: Rc<RefCell<HandlerRegistry>>,
    ) -> Rc<RefCell<HandlerRegistry>>;
    fn build_component(&self, args: InstantiationArgs) -> Rc<dyn InstanceNode>;

    // Provided methods
    fn build_default_common_properties(
        &self,
    ) -> Box<dyn Fn(Rc<RuntimePropertiesStackFrame>, Option<Rc<ExpandedNode>>) -> Option<Rc<RefCell<CommonProperties>>>> { ... }
    fn build_inline_common_properties(
        &self,
        defined_properties: BTreeMap<String, ValueDefinition>,
    ) -> Box<dyn Fn(Rc<RuntimePropertiesStackFrame>, Option<Rc<ExpandedNode>>) -> Option<Rc<RefCell<CommonProperties>>>> { ... }
    fn get_properties_scope_factory(
        &self,
    ) -> Box<dyn Fn(Rc<RefCell<PaxAny>>) -> HashMap<String, Variable>> { ... }
}

Required Methods§

source

fn build_default_properties( &self, ) -> Box<dyn Fn(Rc<RuntimePropertiesStackFrame>, Option<Rc<ExpandedNode>>) -> Option<Rc<RefCell<PaxAny>>>>

Returns the default properties factory for this component

source

fn build_inline_properties( &self, defined_properties: BTreeMap<String, ValueDefinition>, ) -> Box<dyn Fn(Rc<RuntimePropertiesStackFrame>, Option<Rc<ExpandedNode>>) -> Option<Rc<RefCell<PaxAny>>>>

Returns the properties factory based on the defined properties

source

fn build_handler( &self, fn_name: &str, ) -> fn(_: Rc<RefCell<PaxAny>>, _: &NodeContext, _: Option<PaxAny>)

Returns the requested closure for the handler registry based on the defined handlers for this component The argument type is extrapolated based on how the handler was used in the initial compiled template

source

fn build_component_handlers( &self, handlers: Vec<(String, Vec<String>)>, ) -> Rc<RefCell<HandlerRegistry>>

Returns the handler registry based on the defined handlers for this component

source

fn add_inline_handlers( &self, handlers: Vec<(String, String)>, registry: Rc<RefCell<HandlerRegistry>>, ) -> Rc<RefCell<HandlerRegistry>>

source

fn build_component(&self, args: InstantiationArgs) -> Rc<dyn InstanceNode>

Provided Methods§

Implementors§