Struct fv_template::Template
source · pub struct Template { /* private fields */ }
Expand description
A field-value template.
Implementations§
source§impl Template
impl Template
sourcepub fn parse2(input: TokenStream) -> Result<Self, Error>
pub fn parse2(input: TokenStream) -> Result<Self, Error>
Parse a template from a TokenStream
.
The TokenStream
is typically all the tokens given to a macro.
sourcepub fn before_literal_field_values<'a>(
&'a self
) -> impl Iterator<Item = &'a FieldValue>
pub fn before_literal_field_values<'a>( &'a self ) -> impl Iterator<Item = &'a FieldValue>
Field-values that appear before the template string literal.
sourcepub fn literal_field_values<'a>(
&'a self
) -> impl Iterator<Item = &'a FieldValue>
pub fn literal_field_values<'a>( &'a self ) -> impl Iterator<Item = &'a FieldValue>
Field-values that appear within the template string literal.
This is a simple alternative to Template::visit_literal
that iterates over the field-value holes.
sourcepub fn after_literal_field_values<'a>(
&'a self
) -> impl Iterator<Item = &'a FieldValue>
pub fn after_literal_field_values<'a>( &'a self ) -> impl Iterator<Item = &'a FieldValue>
Field-values that appear after the template string literal.
sourcepub fn visit_literal(&self, visitor: impl LiteralVisitor)
pub fn visit_literal(&self, visitor: impl LiteralVisitor)
Visit the parts of the string literal part of the template.
Each fragment of text and field-value hole will be visited in sequence.
Given a template string like:
Some text and a {hole} and some {more}.
the visitor will be called with the following inputs:
visit_text("Some text and a ")
visit_hole("hole")
visit_text(" and some ")
visit_hole("more")
visit_text(".")
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§
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