pub struct FileIndex {
pub headings: Vec<HeadingIndex>,
pub reference_links: Vec<ReferenceLinkIndex>,
pub cross_file_links: Vec<CrossFileLinkIndex>,
pub defined_references: HashSet<String>,
pub content_hash: String,
/* private fields */
}Expand description
Index data extracted from a single file
Fields§
§headings: Vec<HeadingIndex>Headings in this file with their anchors
reference_links: Vec<ReferenceLinkIndex>Reference links in this file (for cross-file analysis)
cross_file_links: Vec<CrossFileLinkIndex>Cross-file links in this file (for MD051 cross-file validation)
defined_references: HashSet<String>Defined reference IDs (e.g., from [ref]: url definitions) Used to filter out reference links that have explicit definitions
content_hash: StringContent hash for change detection
Implementations§
Source§impl FileIndex
impl FileIndex
Sourcepub fn add_heading(&mut self, heading: HeadingIndex)
pub fn add_heading(&mut self, heading: HeadingIndex)
Add a heading to the index
Also updates the anchor lookup map for O(1) anchor queries
Sourcepub fn has_anchor(&self, anchor: &str) -> bool
pub fn has_anchor(&self, anchor: &str) -> bool
Check if an anchor exists in this file (O(1) lookup)
Returns true if the anchor matches either an auto-generated or custom anchor. Matching is case-insensitive.
Sourcepub fn get_heading_by_anchor(&self, anchor: &str) -> Option<&HeadingIndex>
pub fn get_heading_by_anchor(&self, anchor: &str) -> Option<&HeadingIndex>
Get the heading index for an anchor (O(1) lookup)
Returns the index into self.headings if found.
Sourcepub fn add_reference_link(&mut self, link: ReferenceLinkIndex)
pub fn add_reference_link(&mut self, link: ReferenceLinkIndex)
Add a reference link to the index
Sourcepub fn add_cross_file_link(&mut self, link: CrossFileLinkIndex)
pub fn add_cross_file_link(&mut self, link: CrossFileLinkIndex)
Add a cross-file link to the index (deduplicates by target_path, fragment, line, column)
Sourcepub fn add_defined_reference(&mut self, ref_id: String)
pub fn add_defined_reference(&mut self, ref_id: String)
Add a defined reference ID (e.g., from [ref]: url)
Sourcepub fn has_defined_reference(&self, ref_id: &str) -> bool
pub fn has_defined_reference(&self, ref_id: &str) -> bool
Check if a reference ID has an explicit definition
Sourcepub fn hash_matches(&self, hash: &str) -> bool
pub fn hash_matches(&self, hash: &str) -> bool
Check if the content hash matches
Sourcepub fn heading_count(&self) -> usize
pub fn heading_count(&self) -> usize
Get the number of headings
Sourcepub fn reference_link_count(&self) -> usize
pub fn reference_link_count(&self) -> usize
Get the number of reference links
Trait Implementations§
Source§impl<'de> Deserialize<'de> for FileIndex
impl<'de> Deserialize<'de> for FileIndex
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for FileIndex
impl RefUnwindSafe for FileIndex
impl Send for FileIndex
impl Sync for FileIndex
impl Unpin for FileIndex
impl UnwindSafe for FileIndex
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§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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