pub struct Document {
pub id: DocumentId,
pub path: Option<PathBuf>,
pub blocks: Vec<Block>,
pub block_count: u32,
pub zone_maps: ZoneMaps,
/* private fields */
}Expand description
A parsed Markdown document stored in the database.
Fields§
§id: DocumentId§path: Option<PathBuf>Source file path, if the document was loaded from disk.
blocks: Vec<Block>Flattened, interval-indexed block list.
block_count: u32Authoritative block count — valid even when blocks is empty (lazy mode).
zone_maps: ZoneMapsPer-document statistics for query pruning.
Implementations§
Source§impl Document
impl Document
pub fn new(id: DocumentId, path: Option<PathBuf>, blocks: Vec<Block>) -> Self
pub fn from_parts( id: DocumentId, path: Option<PathBuf>, blocks: Vec<Block>, zone_maps: ZoneMaps, ) -> Self
Sourcepub fn from_catalog(
id: DocumentId,
path: Option<PathBuf>,
block_count: u32,
zone_maps: ZoneMaps,
) -> Self
pub fn from_catalog( id: DocumentId, path: Option<PathBuf>, block_count: u32, zone_maps: ZoneMaps, ) -> Self
Construct from catalog metadata only; blocks will be empty.
Sourcepub fn next_sibling<'a>(&'a self, block: &Block) -> Option<&'a Block>
pub fn next_sibling<'a>(&'a self, block: &Block) -> Option<&'a Block>
Returns the block immediately following block in document order
after its entire section (i.e. the next sibling section), or None.
Uses the interval index: the next sibling has pre == block.post + 1.
Sourcepub fn first_child<'a>(&'a self, block: &Block) -> Option<&'a Block>
pub fn first_child<'a>(&'a self, block: &Block) -> Option<&'a Block>
Returns the first content block INSIDE block’s section, or None.
Uses the interval index: the first child has pre == block.pre + 1.
For leaf blocks (no children), this returns None.
Sourcepub fn descendants_of<'a>(
&'a self,
ancestor: &Block,
) -> impl Iterator<Item = &'a Block>
pub fn descendants_of<'a>( &'a self, ancestor: &Block, ) -> impl Iterator<Item = &'a Block>
Returns all blocks that are direct or indirect descendants of
ancestor in the section hierarchy.
Trait Implementations§
impl StructuralPartialEq for Document
Auto Trait Implementations§
impl Freeze 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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more