pub struct Document<'src> { /* private fields */ }Expand description
A document represents the top-level block element in AsciiDoc. It consists of an optional document header and either a) one or more sections preceded by an optional preamble or b) a sequence of top-level blocks only.
The document can be configured using a document header. The header is not a block itself, but contributes metadata to the document, such as the document title and document attributes.
Implementations§
Source§impl<'src> Document<'src>
impl<'src> Document<'src>
Sourcepub fn parse(source: &'src str) -> Self
pub fn parse(source: &'src str) -> Self
Parse a UTF-8 string as an AsciiDoc document.
Note that the document references the underlying source string and necessarily has the same lifetime as the source.
The Document data structure returned by this call and nearly all data
structures contained within it are gated by the lifetime of the source
text passed in to this function. For that reason all of those data
structures are given the lifetime 'src.
IMPORTANT: The AsciiDoc language documentation states that UTF-16
encoding is allowed if a byte-order-mark (BOM) is present at the
start of a file. This format is not directly supported by the
asciidoc-parser crate. Any UTF-16 content must be re-encoded as
UTF-8 prior to parsing.
Any UTF-8 string is a valid AsciiDoc document, so there is no Option
or Result on this API. There may be any number of character sequences
that have ambiguous or potentially unintended meanings. For that reason,
a caller is advised to review the warnings provided via the
Self::warnings iterator.
Trait Implementations§
Source§impl<'src> IsBlock<'src> for Document<'src>
impl<'src> IsBlock<'src> for Document<'src>
Source§fn content_model(&self) -> ContentModel
fn content_model(&self) -> ContentModel
impl<'src> Eq for Document<'src>
impl<'src> StructuralPartialEq for Document<'src>
Auto Trait Implementations§
impl<'src> Freeze for Document<'src>
impl<'src> RefUnwindSafe for Document<'src>
impl<'src> Send for Document<'src>
impl<'src> Sync for Document<'src>
impl<'src> Unpin for Document<'src>
impl<'src> UnwindSafe for Document<'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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)