anathema_value_resolver/
context.rs1use anathema_state::States;
2use anathema_templates::Variables;
3
4use crate::AttributeStorage;
5use crate::functions::{Function, FunctionTable};
6use crate::scope::Scope;
7
8pub struct ResolverCtx<'frame, 'bp> {
9 pub(crate) scope: &'frame Scope<'frame, 'bp>,
10 pub(crate) variables: &'bp Variables,
11 pub(crate) states: &'frame States,
12 pub(crate) attribute_storage: &'frame AttributeStorage<'bp>,
13 pub(crate) function_table: &'bp FunctionTable,
14}
15
16impl<'frame, 'bp> ResolverCtx<'frame, 'bp> {
17 pub fn new(
18 variables: &'bp Variables,
19 scope: &'frame Scope<'frame, 'bp>,
20 states: &'frame States,
21 attribute_storage: &'frame AttributeStorage<'bp>,
22 function_table: &'bp FunctionTable,
23 ) -> Self {
24 Self {
25 scope,
26 variables,
27 states,
28 attribute_storage,
29 function_table,
30 }
31 }
32
33 pub(crate) fn lookup_function(&self, ident: &str) -> Option<&'bp Function> {
34 self.function_table.lookup(ident)
35 }
36}