TemplateLanguage

Trait TemplateLanguage 

Source
pub trait TemplateLanguage<'a> {
    type Property: CoreTemplatePropertyVar<'a>;

    // Required methods
    fn settings(&self) -> &UserSettings;
    fn build_function(
        &self,
        diagnostics: &mut TemplateDiagnostics,
        build_ctx: &BuildContext<'_, Self::Property>,
        function: &FunctionCallNode<'_>,
    ) -> TemplateParseResult<Self::Property>;
    fn build_method(
        &self,
        diagnostics: &mut TemplateDiagnostics,
        build_ctx: &BuildContext<'_, Self::Property>,
        property: Self::Property,
        function: &FunctionCallNode<'_>,
    ) -> TemplateParseResult<Self::Property>;
}
Expand description

Callbacks to build usage-context-specific evaluation objects from AST nodes.

This is used to implement different meanings of self or different globally available functions in the template language depending on the context in which it is invoked.

Required Associated Types§

Required Methods§

Source

fn settings(&self) -> &UserSettings

Source

fn build_function( &self, diagnostics: &mut TemplateDiagnostics, build_ctx: &BuildContext<'_, Self::Property>, function: &FunctionCallNode<'_>, ) -> TemplateParseResult<Self::Property>

Translates the given global function call to a property.

This should be delegated to CoreTemplateBuildFnTable::build_function().

Source

fn build_method( &self, diagnostics: &mut TemplateDiagnostics, build_ctx: &BuildContext<'_, Self::Property>, property: Self::Property, function: &FunctionCallNode<'_>, ) -> TemplateParseResult<Self::Property>

Creates a method call thunk for the given function of the given property.

Implementors§