pub struct Vault<T, F = ObFileOnDisk<T>>{
pub files: Vec<F>,
pub path: PathBuf,
pub phantom: PhantomData<T>,
}Expand description
Represents an entire Obsidian vault
Contains all parsed notes and metadata about the vault. Uses ObFileOnDisk by default
which is optimized for memory efficiency in large vaults.
§Type Parameters
T: Type for frontmatter properties (must implementDeserializeOwned + Default)F: File representation type (ObFileOnDiskrecommended for production use)
Fields§
§files: Vec<F>All files in the vault
path: PathBufPath to vault root directory
phantom: PhantomData<T>Implementations§
Source§impl<T, F> Vault<T, F>
impl<T, F> Vault<T, F>
Sourcepub fn open<P: AsRef<Path>>(path: P) -> Result<Self, Error>
pub fn open<P: AsRef<Path>>(path: P) -> Result<Self, Error>
Opens and parses an Obsidian vault
Recursively scans the directory for Markdown files (.md) and parses them.
Uses ObFileOnDisk by default which is more memory efficient than ObFileInMemory.
§Arguments
path- Path to the vault directory
§Errors
Returns Error if:
- Path doesn’t exist or isn’t a directory
Files that fail parsing are skipped
§Memory Considerations
For vaults with 1000+ notes, prefer ObFileOnDisk (default) over ObFileInMemory as it:
- Uses 90%+ less memory upfront
- Only loads file content when accessed
- Scales better for large knowledge bases
Sourcepub fn has_unique_filenames(&self) -> bool
pub fn has_unique_filenames(&self) -> bool
Checks if all note filenames in the vault are unique
Critical for graph operations where notes are identified by name.
Always run this before calling get_digraph() or get_ungraph().
§Returns
true if all filenames are unique, false otherwise
§Performance
Operates in O(n log n) time - safe for large vaults
Trait Implementations§
impl<T, F> StructuralPartialEq for Vault<T, F>
Auto Trait Implementations§
impl<T, F> Freeze for Vault<T, F>
impl<T, F> RefUnwindSafe for Vault<T, F>where
T: RefUnwindSafe,
F: RefUnwindSafe,
impl<T, F> Send for Vault<T, F>
impl<T, F> Sync for Vault<T, F>
impl<T, F> Unpin for Vault<T, F>
impl<T, F> UnwindSafe for Vault<T, F>where
T: UnwindSafe,
F: UnwindSafe,
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> 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