pub trait Note: Sized {
type Properties: Clone;
type Error: Error;
// Required methods
fn properties(
&self,
) -> Result<Option<Cow<'_, Self::Properties>>, Self::Error>;
fn content(&self) -> Result<Cow<'_, str>, Self::Error>;
fn path(&self) -> Option<Cow<'_, Path>>;
// Provided method
fn note_name(&self) -> Option<String> { ... }
}Expand description
Represents an Obsidian note file with frontmatter properties and content
This trait provides a standardized interface for working with Obsidian markdown files, handling frontmatter parsing, content extraction, and file operations.
§Example
use obsidian_parser::prelude::*;
use serde::Deserialize;
#[derive(Deserialize, Clone)]
struct NoteProperties {
topic: String,
created: String,
}
let note: NoteInMemory<NoteProperties> = NoteFromFile::from_file("note.md").unwrap();
let properties = note.properties().unwrap().unwrap();
println!("Note topic: {}", properties.topic);§Other
Required Associated Types§
Required Methods§
Sourcefn properties(&self) -> Result<Option<Cow<'_, Self::Properties>>, Self::Error>
fn properties(&self) -> Result<Option<Cow<'_, Self::Properties>>, Self::Error>
Returns the parsed properties of frontmatter
Returns None if the note has no properties
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.