pub struct TemplateBody {
pub roots: Vec<BodyNode>,
pub template_idx: DynIdx,
pub node_paths: Vec<Vec<u8>>,
pub attr_paths: Vec<(Vec<u8>, usize)>,
pub dynamic_text_segments: Vec<FormattedSegment>,
pub diagnostics: Diagnostics,
}
Expand description
A set of nodes in a template position
this could be:
- The root of a callbody
- The children of a component
- The children of a for loop
- The children of an if chain
The TemplateBody when needs to be parsed into a surrounding Body
to be correctly re-indexed
By default every body has a 0
default index
Fields§
§roots: Vec<BodyNode>
§template_idx: DynIdx
§node_paths: Vec<Vec<u8>>
§attr_paths: Vec<(Vec<u8>, usize)>
§dynamic_text_segments: Vec<FormattedSegment>
§diagnostics: Diagnostics
Implementations§
Source§impl TemplateBody
impl TemplateBody
Sourcepub fn new(nodes: Vec<BodyNode>) -> Self
pub fn new(nodes: Vec<BodyNode>) -> Self
Create a new TemplateBody from a set of nodes
This will fill in all the necessary path information for the nodes in the template and will overwrite data like dynamic indexes.
Sourcepub fn normalized(&self) -> Self
pub fn normalized(&self) -> Self
Normalize the Template body for rendering. If the body is completely empty, insert a placeholder node
pub fn is_empty(&self) -> bool
pub fn implicit_key(&self) -> Option<&AttributeValue>
pub fn get_dyn_node(&self, path: &[u8]) -> &BodyNode
pub fn get_dyn_attr(&self, path: &Vec<u8>, idx: usize) -> &Attribute
pub fn dynamic_attributes(&self) -> impl DoubleEndedIterator<Item = &Attribute>
pub fn dynamic_nodes(&self) -> impl DoubleEndedIterator<Item = &BodyNode>
Sourcepub fn literal_component_properties(
&self,
) -> impl Iterator<Item = &HotLiteral> + '_
pub fn literal_component_properties( &self, ) -> impl Iterator<Item = &HotLiteral> + '_
Iterate through the literal component properties of this rsx call in depth-first order
Trait Implementations§
Source§impl Clone for TemplateBody
impl Clone for TemplateBody
Source§fn clone(&self) -> TemplateBody
fn clone(&self) -> TemplateBody
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for TemplateBody
impl Debug for TemplateBody
Source§impl Parse for TemplateBody
impl Parse for TemplateBody
Source§fn parse(input: ParseStream<'_>) -> Result<Self>
fn parse(input: ParseStream<'_>) -> Result<Self>
Parse the nodes of the callbody as Body
.
Source§impl PartialEq for TemplateBody
impl PartialEq for TemplateBody
Source§impl ToTokens for TemplateBody
Our ToTokens impl here just defers to rendering a template out like any other Body
.
This is because the parsing phase filled in all the additional metadata we need
impl ToTokens for TemplateBody
Our ToTokens impl here just defers to rendering a template out like any other Body
.
This is because the parsing phase filled in all the additional metadata we need
Source§fn to_tokens(&self, tokens: &mut TokenStream2)
fn to_tokens(&self, tokens: &mut TokenStream2)
Source§fn to_token_stream(&self) -> TokenStream
fn to_token_stream(&self) -> TokenStream
Source§fn into_token_stream(self) -> TokenStreamwhere
Self: Sized,
fn into_token_stream(self) -> TokenStreamwhere
Self: Sized,
impl Eq for TemplateBody
impl StructuralPartialEq for TemplateBody
Auto Trait Implementations§
impl !Freeze for TemplateBody
impl !RefUnwindSafe for TemplateBody
impl !Send for TemplateBody
impl !Sync for TemplateBody
impl Unpin for TemplateBody
impl UnwindSafe for TemplateBody
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Spanned for Twhere
T: Spanned + ?Sized,
impl<T> Spanned for Twhere
T: Spanned + ?Sized,
Source§fn span(&self) -> Span
fn span(&self) -> Span
Returns a
Span
covering the complete contents of this syntax tree
node, or Span::call_site()
if this node is empty.