pub struct ObFileOnDisk<T = HashMap<String, Value>>{
pub path: PathBuf,
/* private fields */
}Expand description
On-disk representation of an Obsidian note file
Optimized for vault operations where:
- Memory efficiency is critical (large vaults)
- Storage is fast (SSD/NVMe)
- Content is accessed infrequently
§Tradeoffs vs ObFileInMemory
| Characteristic | ObFileOnDisk | ObFileInMemory |
|---|---|---|
| Memory usage | Minimal (~24 bytes) | High (content + properties) |
| File access | On-demand | Preloaded |
| Best for | SSD-based vaults | RAM-heavy workflows |
| Content access cost | Disk read | Zero cost |
§Recommendation
Prefer ObFileOnDisk for vault operations on modern hardware. The combination of
SSD speeds and Rust’s efficient I/O makes this implementation ideal for:
- Large vaults (1000+ files)
- Graph processing
§Warning
Requires persistent file access throughout the object’s lifetime. If files are moved/deleted,
calling content() or properties() will panic
Fields§
§path: PathBufAbsolute path to the source Markdown file
Trait Implementations§
Source§impl<T> Clone for ObFileOnDisk<T>
impl<T> Clone for ObFileOnDisk<T>
Source§fn clone(&self) -> ObFileOnDisk<T>
fn clone(&self) -> ObFileOnDisk<T>
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 moreSource§impl<T> Debug for ObFileOnDisk<T>
impl<T> Debug for ObFileOnDisk<T>
Source§impl<T> Default for ObFileOnDisk<T>
impl<T> Default for ObFileOnDisk<T>
Source§fn default() -> ObFileOnDisk<T>
fn default() -> ObFileOnDisk<T>
Returns the “default value” for a type. Read more
Source§impl<T: DeserializeOwned + Default + Clone + Send> ObFile<T> for ObFileOnDisk<T>
impl<T: DeserializeOwned + Default + Clone + Send> ObFile<T> for ObFileOnDisk<T>
Source§fn content(&self) -> String
fn content(&self) -> String
Returns the note’s content body (without frontmatter)
§Panics
- If file doesn’t exist
- On filesystem errors
- If file contains invalid UTF-8
§Performance
Performs disk read on every call. Suitable for:
- Single-pass processing (link extraction, analysis)
- Large files where in-memory storage is prohibitive
For repeated access, consider caching or ObFileInMemory.
Source§fn properties(&self) -> T
fn properties(&self) -> T
Source§impl<T> PartialEq for ObFileOnDisk<T>
impl<T> PartialEq for ObFileOnDisk<T>
impl<T> StructuralPartialEq for ObFileOnDisk<T>
Auto Trait Implementations§
impl<T> Freeze for ObFileOnDisk<T>
impl<T> RefUnwindSafe for ObFileOnDisk<T>where
T: RefUnwindSafe,
impl<T> Send for ObFileOnDisk<T>
impl<T> Sync for ObFileOnDisk<T>where
T: Sync,
impl<T> Unpin for ObFileOnDisk<T>where
T: Unpin,
impl<T> UnwindSafe for ObFileOnDisk<T>where
T: 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
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> 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