pub enum TextSegment {
Literal(String),
Expr(Arc<Expr>),
MarkupOpen {
name: String,
properties: Vec<(String, String)>,
},
MarkupClose {
name: String,
},
MarkupSelfClose {
name: String,
properties: Vec<(String, String)>,
},
}Expand description
One segment of text that may contain {expr} fragments or inline markup.
Line text, option text, line-variant text, and command argument strings are
all stored as Vec<TextSegment> so that {expr} fragments are parsed once
at compile time and evaluated cheaply at runtime. Markup open/close/self-close
segments record tag boundaries without carrying any text; byte offsets into
the final rendered string are computed at runtime by crate::runtime.
Variants§
Literal(String)
A literal string with no interpolation.
Expr(Arc<Expr>)
An {expr} fragment whose source has already been parsed.
MarkupOpen
An opening markup tag: [name] or [name key=val …].
Fields
MarkupClose
A closing markup tag: [/name].
MarkupSelfClose
A self-closing markup tag: [name /] or [name key=val … /].
Implementations§
Trait Implementations§
Source§impl Clone for TextSegment
impl Clone for TextSegment
Source§fn clone(&self) -> TextSegment
fn clone(&self) -> TextSegment
Returns a duplicate 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 moreAuto Trait Implementations§
impl Freeze for TextSegment
impl RefUnwindSafe for TextSegment
impl Send for TextSegment
impl Sync for TextSegment
impl Unpin for TextSegment
impl UnsafeUnpin for TextSegment
impl UnwindSafe for TextSegment
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