Struct rocket_dyn_templates::tera::Template
source · [−]pub struct Template {
pub name: String,
pub path: Option<String>,
pub ast: Vec<Node, Global>,
pub from_extend: bool,
pub macros: HashMap<String, MacroDefinition, RandomState>,
pub imported_macro_files: Vec<(String, String), Global>,
pub parent: Option<String>,
pub blocks: HashMap<String, Block, RandomState>,
pub parents: Vec<String, Global>,
pub blocks_definitions: HashMap<String, Vec<(String, Block), Global>, RandomState>,
}
Expand description
This is the parsed equivalent of a template file. It also does some pre-processing to ensure it does as little as possible at runtime Not meant to be used directly.
Fields
name: String
Name of the template, usually very similar to the path
path: Option<String>
Original path of the file. A template doesn’t necessarily have a file associated with it though so it’s optional.
ast: Vec<Node, Global>
Parsed AST, after whitespace removal
from_extend: bool
Whether this template came from a call to Tera::extend
, so we do
not remove it when we are doing a template reload
macros: HashMap<String, MacroDefinition, RandomState>
Macros defined in that file: name -> definition ast
imported_macro_files: Vec<(String, String), Global>
(filename, namespace) for the macros imported in that file
parent: Option<String>
Only used during initial parsing. Rendering will use self.parents
blocks: HashMap<String, Block, RandomState>
Only used during initial parsing. Rendering will use self.blocks_definitions
parents: Vec<String, Global>
The full list of parent templates
blocks_definitions: HashMap<String, Vec<(String, Block), Global>, RandomState>
The definition of all the blocks for the current template and the definition of those blocks
in parent templates if there are some.
Needed for super() to work without having to find them each time.
The type corresponds to the following block_name -> [(template name, definition)]
The order of the Vec is from the first in hierarchy to the current template and the template
name is needed in order to load its macros if necessary.
Implementations
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Template
impl Send for Template
impl Sync for Template
impl Unpin for Template
impl UnwindSafe for Template
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<T> IntoCollection<T> for T
impl<T> IntoCollection<T> for T
fn into_collection<A>(self) -> SmallVec<A> where
A: Array<Item = T>,
fn into_collection<A>(self) -> SmallVec<A> where
A: Array<Item = T>,
Converts self
into a collection.
fn mapped<U, F, A>(self, f: F) -> SmallVec<A> where
F: FnMut(T) -> U,
A: Array<Item = U>,
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more