pub(crate) struct WikilinkIndex {
filenames: Arc<Mutex<HashMap<OsString, PathBuf>>>,
local_base: PathBuf,
}Expand description
Indexes a given directory mapping filenames to their corresponding path.
The WikilinkIndex recursively checks all subdirectories of the given
base directory mapping any found files to the path where they can be found.
Symlinks are ignored to prevent it from infinite loops.
Fields§
§filenames: Arc<Mutex<HashMap<OsString, PathBuf>>>§local_base: PathBufLocal base directory
Implementations§
Source§impl WikilinkIndex
impl WikilinkIndex
pub(crate) fn new(local_base: PathBuf) -> Self
Sourcepub(crate) fn start_indexing(&self)
pub(crate) fn start_indexing(&self)
Populates the index of the WikilinkIndex on startup by walking
the local base directory, mapping each filename to an absolute filepath.
Sourcepub(crate) fn contains_path(&self, path: &Path) -> Option<PathBuf>
pub(crate) fn contains_path(&self, path: &Path) -> Option<PathBuf>
Checks the index for a filename. Returning the absolute path if the name is found, otherwise returning None
Trait Implementations§
Source§impl Clone for WikilinkIndex
impl Clone for WikilinkIndex
Source§fn clone(&self) -> WikilinkIndex
fn clone(&self) -> WikilinkIndex
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for WikilinkIndex
impl RefUnwindSafe for WikilinkIndex
impl Send for WikilinkIndex
impl Sync for WikilinkIndex
impl Unpin for WikilinkIndex
impl UnsafeUnpin for WikilinkIndex
impl UnwindSafe for WikilinkIndex
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
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>
Converts
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>
Converts
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