pub struct Note {
pub name: String,
pub path: PathBuf,
}Expand description
Represents a single note (Markdown file) within a vault.
Fields§
§name: StringThe base filename without .md extension.
path: PathBufFilesystem path to the .md file.
Implementations§
Source§impl Note
impl Note
Sourcepub fn read_to_string(note: &Note) -> Result<String>
pub fn read_to_string(note: &Note) -> Result<String>
Reads the note’s contents from disk to a String.
§Examples
use basalt_core::obsidian::Note;
let note = Note {
name: "Example".to_string(),
path: "path/to/Example.md".into(),
};
_ = Note::read_to_string(¬e);Sourcepub fn write(note: &Note, contents: String) -> Result<()>
pub fn write(note: &Note, contents: String) -> Result<()>
Replaces the content in the notes’ markdown file with the given content.
§Examples
use basalt_core::obsidian::Note;
let note = Note {
name: "Example".to_string(),
path: "path/to/Example.md".into(),
};
_ = Note::write(¬e, String::from("# Heading"));Trait Implementations§
impl StructuralPartialEq for Note
Auto Trait Implementations§
impl Freeze for Note
impl RefUnwindSafe for Note
impl Send for Note
impl Sync for Note
impl Unpin for Note
impl UnwindSafe for Note
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