pub struct Document {
pub path: RepoPath,
pub source: Source,
pub frontmatter: Option<Spanned>,
pub core: CoreFields,
pub body: Body,
pub segments: Segments,
pub body_line: usize,
pub lines: usize,
pub frontmatter_found: bool,
}Expand description
A Document is one parsed document.
Fields§
§path: RepoPathThe file.
source: SourceThe text.
frontmatter: Option<Spanned>The frontmatter, when it parses.
core: CoreFieldsThe core fields.
body: BodyThe body.
segments: SegmentsThe markers.
body_line: usizeThe line the body starts on.
lines: usizeThe number of lines in the file.
frontmatter_found: boolWhether the file opens with a frontmatter block, parsed or not.
Implementations§
Source§impl Document
impl Document
Sourcepub fn new(source: Source, parsed: Parsed) -> Self
pub fn new(source: Source, parsed: Parsed) -> Self
new assembles a document from its source and the result of parsing it.
Sourcepub fn visible_hash(&self) -> u64
pub fn visible_hash(&self) -> u64
visible_hash returns the hash of the parts of this document that the
checks of other documents read: its id, type, title, description,
status, resource, headings, anchors, and whether it has a frontmatter
block (CACHE-1_AC-13). The headings include each heading inside a
quote or a list item, because a link can refer to it.
Sourcepub fn line_count(&self) -> usize
pub fn line_count(&self) -> usize
line_count returns the number of lines in the file.
Trait Implementations§
impl StructuralPartialEq for Document
Auto Trait Implementations§
impl Forget for Document
impl Freeze for Document
impl Move for Document
impl RefUnwindSafe for Document
impl Send for Document
impl Sync for Document
impl Unpin for Document
impl UnsafeUnpin for Document
impl UnwindSafe for Document
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