pub struct NoteOnceCell<T = HashMap<String, Value>>where
T: Clone + DeserializeOwned,{ /* private fields */ }Expand description
On-disk representation of an Obsidian note file with cache
§Warning
It is not thread-safe!
Use NoteOnceLock
Implementations§
Source§impl<T> NoteOnceCell<T>where
T: DeserializeOwned + Clone,
impl<T> NoteOnceCell<T>where
T: DeserializeOwned + Clone,
Trait Implementations§
Source§impl<T> Clone for NoteOnceCell<T>
impl<T> Clone for NoteOnceCell<T>
Source§fn clone(&self) -> NoteOnceCell<T>
fn clone(&self) -> NoteOnceCell<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 NoteOnceCell<T>
impl<T> Debug for NoteOnceCell<T>
Source§impl<T> Default for NoteOnceCell<T>
impl<T> Default for NoteOnceCell<T>
Source§fn default() -> NoteOnceCell<T>
fn default() -> NoteOnceCell<T>
Returns the “default value” for a type. Read more
Source§impl<T> Note for NoteOnceCell<T>where
T: DeserializeOwned + Clone,
impl<T> Note for NoteOnceCell<T>where
T: DeserializeOwned + Clone,
Source§fn properties(&self) -> Result<Option<Cow<'_, T>>, Error>
fn properties(&self) -> Result<Option<Cow<'_, T>>, Error>
Parses YAML frontmatter directly from disk
§Errors
Error::Yamlif properties can’t be deserializedError::IsNotFileIf file doesn’t existError::IOon filesystem error
Source§fn content(&self) -> Result<Cow<'_, str>, Error>
fn content(&self) -> Result<Cow<'_, str>, Error>
Returns the note’s content body (without frontmatter)
§Errors
Error::IOon filesystem error
§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 NoteInMemory.
Source§type Properties = T
type Properties = T
Frontmatter properties type
Source§impl<T> NoteFromFile for NoteOnceCell<T>where
T: DeserializeOwned + Clone,
Available on non-target_family=wasm only.
impl<T> NoteFromFile for NoteOnceCell<T>where
T: DeserializeOwned + Clone,
Available on non-
target_family=wasm only.Source§impl<T> PartialEq for NoteOnceCell<T>
impl<T> PartialEq for NoteOnceCell<T>
impl<T> Eq for NoteOnceCell<T>
impl<T> StructuralPartialEq for NoteOnceCell<T>where
T: Clone + DeserializeOwned,
Auto Trait Implementations§
impl<T = HashMap<String, Value>> !Freeze for NoteOnceCell<T>
impl<T = HashMap<String, Value>> !RefUnwindSafe for NoteOnceCell<T>
impl<T> Send for NoteOnceCell<T>where
T: Send,
impl<T = HashMap<String, Value>> !Sync for NoteOnceCell<T>
impl<T> Unpin for NoteOnceCell<T>where
T: Unpin,
impl<T> UnwindSafe for NoteOnceCell<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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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 moreSource§impl<T> NoteDefault for T
impl<T> NoteDefault for T
Source§fn from_string_default(
raw_text: impl AsRef<str>,
) -> Result<T, <T as Note>::Error>
fn from_string_default( raw_text: impl AsRef<str>, ) -> Result<T, <T as Note>::Error>
Same as
NoteFromString::from_string with default properties typeSource§fn from_file_default(path: impl AsRef<Path>) -> Result<T, <T as Note>::Error>
fn from_file_default(path: impl AsRef<Path>) -> Result<T, <T as Note>::Error>
Available on non-
target_family=wasm only.Same as
crate::note::NoteFromFile::from_file with default properties typeSource§fn from_reader_default(reader: &mut impl Read) -> Result<T, <T as Note>::Error>where
T: NoteFromReader,
<T as Note>::Properties: DeserializeOwned,
<T as Note>::Error: From<Error>,
fn from_reader_default(reader: &mut impl Read) -> Result<T, <T as Note>::Error>where
T: NoteFromReader,
<T as Note>::Properties: DeserializeOwned,
<T as Note>::Error: From<Error>,
Same as
NoteFromReader::from_reader with default properties type