pub struct Record {
pub path: PathBuf,
pub fields: BTreeMap<String, Value>,
pub raw_content: Option<String>,
}Expand description
One parsed .md file = one record.
Serialization note: path serializes as a string. For machine-portable
JSON, store records relative to the vault root before round-tripping;
absolute paths are host-specific. raw_content is skipped when None
so the wire format stays compact for record listings that don’t include
body text.
Fields§
§path: PathBufAbsolute path to the .md file.
fields: BTreeMap<String, Value>Parsed frontmatter fields.
raw_content: Option<String>Raw file content — only loaded for write operations.
Implementations§
Source§impl Record
impl Record
Sourcepub fn get(&self, key: &str, vault_root: &Path) -> Option<Value>
pub fn get(&self, key: &str, vault_root: &Path) -> Option<Value>
Look up a field by name, checking virtual fields first.
Sourcepub fn get_with_links(
&self,
key: &str,
vault_root: &Path,
link_index: Option<&LinkGraph>,
) -> Option<Value>
pub fn get_with_links( &self, key: &str, vault_root: &Path, link_index: Option<&LinkGraph>, ) -> Option<Value>
Look up a field, including graph virtual fields when a link index is provided.
Sourcepub fn virtual_name(&self) -> String
pub fn virtual_name(&self) -> String
Filename without .md extension, with URL-encoded characters decoded.
Sourcepub fn virtual_path(&self, vault_root: &Path) -> String
pub fn virtual_path(&self, vault_root: &Path) -> String
Relative path from vault root.
Sourcepub fn virtual_folder(&self) -> String
pub fn virtual_folder(&self) -> String
Parent folder name.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Record
impl<'de> Deserialize<'de> for Record
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
Auto Trait Implementations§
impl Freeze for Record
impl RefUnwindSafe for Record
impl Send for Record
impl Sync for Record
impl Unpin for Record
impl UnsafeUnpin for Record
impl UnwindSafe for Record
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