pub struct NoteInMemory<T = HashMap<String, Value>>where
T: Clone,{ /* private fields */ }Expand description
In-memory representation of an Obsidian note file
This struct provides full access to parsed note content, properties, and path. It stores the entire file contents in memory, making it suitable for:
- Frequent access to note content
- Transformation or analysis workflows
- Environments with fast storage (SSD/RAM disks)
§Performance Considerations
- Uses ~2x memory of original file size (UTF-8 + deserialized properties)
- Preferred for small-to-medium vaults (<10k notes)
For large vaults or read-heavy workflows, consider NoteOnDisk.
Implementations§
Trait Implementations§
Source§impl<T> Clone for NoteInMemory<T>
impl<T> Clone for NoteInMemory<T>
Source§fn clone(&self) -> NoteInMemory<T>
fn clone(&self) -> NoteInMemory<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 NoteInMemory<T>
impl<T> Debug for NoteInMemory<T>
Source§impl<T> Default for NoteInMemory<T>
impl<T> Default for NoteInMemory<T>
Source§fn default() -> NoteInMemory<T>
fn default() -> NoteInMemory<T>
Returns the “default value” for a type. Read more
Source§impl<T> Note for NoteInMemory<T>where
T: Clone,
impl<T> Note for NoteInMemory<T>where
T: Clone,
Source§fn properties(&self) -> Result<Option<Cow<'_, T>>, Self::Error>
fn properties(&self) -> Result<Option<Cow<'_, T>>, Self::Error>
Get Self::Properties
Source§type Properties = T
type Properties = T
Frontmatter properties type
Source§impl<T> NoteFromFile for NoteInMemory<T>where
T: DeserializeOwned + Clone,
Available on non-target_family=wasm only.
impl<T> NoteFromFile for NoteInMemory<T>where
T: DeserializeOwned + Clone,
Available on non-
target_family=wasm only.Source§impl<T> NoteFromString for NoteInMemory<T>where
T: DeserializeOwned + Clone,
impl<T> NoteFromString for NoteInMemory<T>where
T: DeserializeOwned + Clone,
Source§fn from_string(raw_text: impl AsRef<str>) -> Result<Self, Self::Error>
fn from_string(raw_text: impl AsRef<str>) -> Result<Self, Self::Error>
Parses a string into an in-memory Obsidian note representation
§Arguments
raw_text- Full note text including optional frontmatterpath- Optional source path for reference
§Process
- Splits text into frontmatter/content sections
- Parses YAML frontmatter if present
- Stores content without frontmatter delimiters
§Errors
Error::InvalidFormatfor malformed frontmatterError::Yamlfor invalid YAML syntax
§Example
use obsidian_parser::prelude::*;
use serde::Deserialize;
#[derive(Deserialize, Clone, Default)]
struct NoteProperties {
title: String
}
let text = r#"---
title: Example
---
Content"#;
let note: NoteInMemory<NoteProperties> = NoteInMemory::from_string(text).unwrap();
let properties = note.properties().unwrap().unwrap();
assert_eq!(properties.title, "Example");
assert_eq!(note.content().unwrap(), "Content");Source§impl<T> PartialEq for NoteInMemory<T>
impl<T> PartialEq for NoteInMemory<T>
impl<T> Eq for NoteInMemory<T>
impl<T> StructuralPartialEq for NoteInMemory<T>where
T: Clone,
Auto Trait Implementations§
impl<T> Freeze for NoteInMemory<T>where
T: Freeze,
impl<T> RefUnwindSafe for NoteInMemory<T>where
T: RefUnwindSafe,
impl<T> Send for NoteInMemory<T>where
T: Send,
impl<T> Sync for NoteInMemory<T>where
T: Sync,
impl<T> Unpin for NoteInMemory<T>where
T: Unpin,
impl<T> UnwindSafe for NoteInMemory<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