pub enum Span<T, A> {
Text(T),
Expr(A),
}Expand description
A component of a template, either text or an expression.
A μfmt template is internally represented as a list of Spans. Spans are parsed
deterministically according to precise breaking rules.
There are two ways to access the spans associated with a template:
- From a
Templateusing theTemplate::spansmethod - As an iterator over the spans of a template string using
TemplateSpans.
See the TemplateSpans documentation for more detail and examples.
Variants§
Implementations§
Trait Implementations§
Source§impl<T, A> Extend<Span<T, A>> for Template<T, A>
impl<T, A> Extend<Span<T, A>> for Template<T, A>
Source§fn extend<I: IntoIterator<Item = Span<T, A>>>(&mut self, iter: I)
fn extend<I: IntoIterator<Item = Span<T, A>>>(&mut self, iter: I)
Extends a collection with the contents of an iterator. Read more
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
🔬This is a nightly-only experimental API. (
extend_one)Extends a collection with exactly one element.
Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
🔬This is a nightly-only experimental API. (
extend_one)Reserves capacity in a collection for the given number of additional elements. Read more
Source§impl<T, A> FromIterator<Span<T, A>> for Template<T, A>
impl<T, A> FromIterator<Span<T, A>> for Template<T, A>
impl<T, A> StructuralPartialEq for Span<T, A>
Auto Trait Implementations§
impl<T, A> Freeze for Span<T, A>
impl<T, A> RefUnwindSafe for Span<T, A>where
T: RefUnwindSafe,
A: RefUnwindSafe,
impl<T, A> Send for Span<T, A>
impl<T, A> Sync for Span<T, A>
impl<T, A> Unpin for Span<T, A>
impl<T, A> UnwindSafe for Span<T, A>where
T: UnwindSafe,
A: UnwindSafe,
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