pub struct CallBody {
pub body: TemplateBody,
pub template_idx: Cell<usize>,
}
Expand description
The Callbody is the contents of the rsx! macro
It is a list of BodyNodes, which are the different parts of the template. The Callbody contains no information about how the template will be rendered, only information about the parsed tokens.
Every callbody should be valid, so you can use it to build a template.
To generate the code used to render the template, use the ToTokens impl on the Callbody, or with the render_with_location
method.
Ideally we don’t need the metadata here and can bake the idx-es into the templates themselves but I haven’t figured out how to do that yet.
Fields§
§body: TemplateBody
§template_idx: Cell<usize>
Implementations§
Source§impl CallBody
impl CallBody
Sourcepub fn new(body: TemplateBody) -> Self
pub fn new(body: TemplateBody) -> Self
Create a new CallBody from a TemplateBody
This will overwrite all internal metadata regarding hotreloading.
Sourcepub fn parse_strict(input: ParseStream<'_>) -> Result<Self>
pub fn parse_strict(input: ParseStream<'_>) -> Result<Self>
Parse a stream into a CallBody. Return all error immediately instead of trying to partially expand the macro
This should be preferred over parse
if you are outside of a macro
Trait Implementations§
Source§impl ToTokens for CallBody
impl ToTokens for CallBody
Source§fn to_tokens(&self, out: &mut TokenStream2)
fn to_tokens(&self, out: &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,
Auto Trait Implementations§
impl !Freeze for CallBody
impl !RefUnwindSafe for CallBody
impl !Send for CallBody
impl !Sync for CallBody
impl Unpin for CallBody
impl UnwindSafe for CallBody
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
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
Span
covering the complete contents of this syntax tree
node, or Span::call_site()
if this node is empty.