pub struct LineTemplate {
pub source: String,
pub segments: Vec<Segment>,
/* private fields */
}Expand description
A compiled template.
Fields§
§source: StringThe template as written.
segments: Vec<Segment>Its pieces, in order.
Implementations§
Source§impl Template
impl Template
Sourcepub fn parse(source: &str, types: &TypeRegistry) -> Result<Template, Problem>
pub fn parse(source: &str, types: &TypeRegistry) -> Result<Template, Problem>
Parse and compile source against types. Refuses an unclosed
hole, a bad or repeated name, an unknown type, and a template with
no hole, which is text.
Sourcepub fn read_with(&self, read: &dyn Fn(&str) -> String) -> Option<Template>
pub fn read_with(&self, read: &dyn Fn(&str) -> String) -> Option<Template>
The template as a format grammar reads it: its literals and a
placeholder for each hole, HOLE, read whole through read, then
split again at the placeholders, so that a literal is read in the
context of the template. The template keeps its source and its
literals as written, which a failure quotes. None where the
reading keeps no placeholder for each hole, or leaves a literal
empty, or the template no longer compiles.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Template
impl Forget for Template
impl Move for Template
impl RefUnwindSafe for Template
impl Send for Template
impl Sync for Template
impl Unpin for Template
impl UnsafeUnpin 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