pub struct TemplatedDocument<'src> { /* private fields */ }Expand description
A parsed templated-YAML source: the layout node forest with document boundaries.
Implementations§
Source§impl<'src> TemplatedDocument<'src>
impl<'src> TemplatedDocument<'src>
Sourcepub fn parse(source: &'src str) -> Self
pub fn parse(source: &'src str) -> Self
Parse a template source, running the Go-template parse internally. Returns an empty document when tree-sitter fails entirely (layout still parses; only action holes would be missing, so failure is modeled as a document with no action tokens).
Sourcepub fn parse_with_root(source: &'src str, root: Node<'_>) -> Self
pub fn parse_with_root(source: &'src str, root: Node<'_>) -> Self
Parse a template source reusing an existing Go-template parse of the same source (avoids a second tree-sitter pass).
Sourcepub fn document_spans(&self) -> &[Span]
pub fn document_spans(&self) -> &[Span]
Top-level document spans, split at --- separator lines (nonempty
spans only, mirroring the resource-identity document splitter).
Auto Trait Implementations§
impl<'src> Freeze for TemplatedDocument<'src>
impl<'src> RefUnwindSafe for TemplatedDocument<'src>
impl<'src> Send for TemplatedDocument<'src>
impl<'src> Sync for TemplatedDocument<'src>
impl<'src> Unpin for TemplatedDocument<'src>
impl<'src> UnsafeUnpin for TemplatedDocument<'src>
impl<'src> UnwindSafe for TemplatedDocument<'src>
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