pub struct BacklinkIndex { /* private fields */ }Expand description
Bidirectional link index.
Maintains forward links (source → targets) and backward links (target → sources) for O(1) lookup.
Implementations§
Source§impl BacklinkIndex
impl BacklinkIndex
Sourcepub fn index_file(&mut self, path: &str, content: &str)
pub fn index_file(&mut self, path: &str, content: &str)
Index all links in a file’s content.
Replaces any previously indexed links for this file (incremental update). Markdown links only — wikilinks are not resolved.
Sourcepub fn index_file_with(
&mut self,
path: &str,
content: &str,
stem_index: &StemIndex,
)
pub fn index_file_with( &mut self, path: &str, content: &str, stem_index: &StemIndex, )
Index both markdown links AND wikilinks. Wikilink targets are
resolved against stem_index (basename → paths) so a bare
[[Rust]] lands under the canonical path it actually points at.
Ambiguous/unresolved wikilinks are silently skipped — they’re not
indexed, so a later rename of any single candidate won’t rewrite
them (design doc §6).
Sourcepub fn remove_file(&mut self, path: &str)
pub fn remove_file(&mut self, path: &str)
Remove a file from the index.
Sourcepub fn backlinks_for(&self, path: &str) -> Vec<Backlink>
pub fn backlinks_for(&self, path: &str) -> Vec<Backlink>
Get all backlinks pointing to a file (files that reference this one).
Sourcepub fn sources_for(&self, target: &str) -> HashSet<String>
pub fn sources_for(&self, target: &str) -> HashSet<String>
Get the set of source files that link to target (the backward index
entry). Used by note_move to find every file whose links must be
rewritten when the target is renamed.
Sourcepub fn forward_links_for(&self, path: &str) -> Vec<String>
pub fn forward_links_for(&self, path: &str) -> Vec<String>
Get all forward links from a file (files this one references).
Sourcepub fn backlink_count(&self, path: &str) -> usize
pub fn backlink_count(&self, path: &str) -> usize
Get the number of backlinks for a file.
Sourcepub fn link_graph(&self) -> LinkGraph
pub fn link_graph(&self) -> LinkGraph
Get the full link graph for visualization.
Sourcepub fn connection_strength(&self, path_a: &str, path_b: &str) -> usize
pub fn connection_strength(&self, path_a: &str, path_b: &str) -> usize
Compute connection strength between two files (shared backlink sources).
Trait Implementations§
Source§impl Clone for BacklinkIndex
impl Clone for BacklinkIndex
Source§fn clone(&self) -> BacklinkIndex
fn clone(&self) -> BacklinkIndex
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more