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§
type Property: CoreTemplatePropertyVar<'a>
Required Methods§
fn settings(&self) -> &UserSettings
Sourcefn build_function(
&self,
diagnostics: &mut TemplateDiagnostics,
build_ctx: &BuildContext<'_, Self::Property>,
function: &FunctionCallNode<'_>,
) -> TemplateParseResult<Self::Property>
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()
.
Sourcefn build_method(
&self,
diagnostics: &mut TemplateDiagnostics,
build_ctx: &BuildContext<'_, Self::Property>,
property: 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>
Creates a method call thunk for the given function
of the given
property
.