pub struct Vault {
pub name: String,
pub path: PathBuf,
pub open: bool,
pub ts: u64,
}Expand description
Represents a single Obsidian vault.
A vault is a folder containing notes and other metadata.
Fields§
§name: StringThe name of the vault, inferred from its directory name.
path: PathBufFilesystem path to the vault’s directory.
open: boolWhether the vault is marked ‘open’ by Obsidian.
ts: u64Timestamp of last update or creation.
Implementations§
Source§impl Vault
impl Vault
Sourcepub fn notes_sorted_by(
&self,
compare: impl Fn(&Note, &Note) -> Ordering,
) -> Vec<Note>
pub fn notes_sorted_by( &self, compare: impl Fn(&Note, &Note) -> Ordering, ) -> Vec<Note>
Returns a sorted vector Vec<Note> of all notes in the vault, sorted according to the
provided comparison function.
§Examples
use std::cmp::Ordering;
use basalt_core::obsidian::{Vault, Note};
let vault = Vault {
name: "MyVault".to_string(),
path: "path/to/my_vault".into(),
..Default::default()
};
let alphabetically = |a: &Note, b: &Note| a.name.to_lowercase().cmp(&b.name.to_lowercase());
_ = vault.notes_sorted_by(alphabetically);Trait Implementations§
Source§impl<'de> Deserialize<'de> for Vault
impl<'de> Deserialize<'de> for Vault
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>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for Vault
Auto Trait Implementations§
impl Freeze for Vault
impl RefUnwindSafe for Vault
impl Send for Vault
impl Sync for Vault
impl Unpin for Vault
impl UnwindSafe for Vault
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