pub(crate) struct TextDocument<'a> {
parts: Vec<Part<'a>>,
}Expand description
A validated plain text document. Rendering cannot fail.
Fields§
§parts: Vec<Part<'a>>Implementations§
Source§impl<'a> TextDocument<'a>
impl<'a> TextDocument<'a>
Sourcepub(crate) fn new(
syntax: Option<CommentSyntax>,
nodes: &'a [DocumentNode],
) -> Result<Self, TextError>
pub(crate) fn new( syntax: Option<CommentSyntax>, nodes: &'a [DocumentNode], ) -> Result<Self, TextError>
Validate the nodes against the comment syntax.
§Errors
Returns an error when a comment node has no syntax to render with,
contains a carriage return or another character that corrupts output,
would contain the XML closing delimiter
(-->) under CommentSyntax::Xml, or follows text that does not end
a line.
Source§impl TextDocument<'_>
impl TextDocument<'_>
Sourcepub(crate) fn generated(self, syntax: Option<CommentSyntax>) -> Self
pub(crate) fn generated(self, syntax: Option<CommentSyntax>) -> Self
Put the generated marker and a blank line in front, when the syntax can express a comment.
Trait Implementations§
Source§impl<'a> Clone for TextDocument<'a>
impl<'a> Clone for TextDocument<'a>
Source§fn clone(&self) -> TextDocument<'a>
fn clone(&self) -> TextDocument<'a>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<'a> Debug for TextDocument<'a>
impl<'a> Debug for TextDocument<'a>
Auto Trait Implementations§
impl<'a> Freeze for TextDocument<'a>
impl<'a> RefUnwindSafe for TextDocument<'a>
impl<'a> Send for TextDocument<'a>
impl<'a> Sync for TextDocument<'a>
impl<'a> Unpin for TextDocument<'a>
impl<'a> UnsafeUnpin for TextDocument<'a>
impl<'a> UnwindSafe for TextDocument<'a>
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