pub trait TemplateLanguage<'a> {
type Property: CoreTemplatePropertyVar<'a> + 'a;
// Required methods
fn settings(&self) -> &UserSettings;
fn current_dir(&self) -> &Path;
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> + 'a
Required Methods§
fn settings(&self) -> &UserSettings
Sourcefn current_dir(&self) -> &Path
fn current_dir(&self) -> &Path
Returns the working directory for filesystem path template methods.
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.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".