Skip to main content

Frontmatter

Struct Frontmatter 

Source
pub struct Frontmatter {
    pub type_: Option<String>,
    pub id: Option<String>,
    pub created: Option<DateTime<FixedOffset>>,
    pub updated: Option<DateTime<FixedOffset>>,
    pub summary: Option<String>,
    pub status: Option<String>,
    pub tags: Vec<String>,
    pub extra: BTreeMap<String, Value>,
}
Expand description

The parsed YAML frontmatter of a db.md file.

The universal-contract fields are typed accessors; everything else lands in extra as ambient context (unknown-field passthrough) and is round-tripped verbatim. The atomic writer re-emits keys in canonical order: type, id, created, updated, summary first, then type-specific fields, then status / tags.

Fields§

§type_: Option<String>

type — required on content files; the primary query key.

§id: Option<String>

id — optional; derived from the file path when absent.

§created: Option<DateTime<FixedOffset>>

created — RFC3339; required and auto-set on content-file create.

§updated: Option<DateTime<FixedOffset>>

updated — RFC3339; required and auto-maintained on content files.

§summary: Option<String>

summary — the one-line catalog line; required on every content file.

§status: Option<String>

status — optional lifecycle state.

§tags: Vec<String>

tags — optional flat list of short scalar labels.

§extra: BTreeMap<String, Value>

All other frontmatter keys (type-specific + custom), preserved verbatim in insertion-stable sorted order. Wiki-link-valued fields keep their raw YAML form here; Frontmatter::link_fields surfaces them as WikiLinks.

Implementations§

Source§

impl Frontmatter

Source

pub fn parse(yaml: &str, file: &Path) -> Result<Self, ParseError>

Parse a YAML frontmatter block (the text between the opening and closing --- fences, exclusive) into a Frontmatter.

Lenient on unknown keys (they go to extra); returns ParseError::MalformedYaml only on YAML that doesn’t parse.

Source

pub fn to_yaml(&self) -> String

Serialize the frontmatter back to a YAML block (no --- fences) in canonical key order. Round-trips extra verbatim.

Source

pub fn is_content_file(path: &Path) -> bool

True if the file is content (under sources/, records/, or wiki/) and not an index.md. Used by validate to decide which files require a summary. Meta files (DB.md, index.md, log.md) return false.

Source

pub fn effective_id(&self, store_relative_path: &Path) -> String

Resolve the file’s effective id: the explicit id field if present, otherwise derived from the store-relative path (filename without .md).

Source

pub fn get(&self, key: &str) -> Option<Value>

Read a single frontmatter key as a raw YAML Value, looking in the typed fields first and then extra.

Source

pub fn set(&mut self, key: &str, value: &str) -> Result<(), ParseError>

Set a single frontmatter key from a string value, routing universal- contract keys to their typed fields and everything else to extra. Used by dbmd fm set.

Extract every frontmatter field whose value is a wiki-link (scalar inline form or a block-sequence list), pairing each with its key. The validate engine checks these against (link) schema annotations.

Trait Implementations§

Source§

impl Clone for Frontmatter

Source§

fn clone(&self) -> Frontmatter

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Frontmatter

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Frontmatter

Source§

fn default() -> Frontmatter

Returns the “default value” for a type. Read more
Source§

impl PartialEq for Frontmatter

Source§

fn eq(&self, other: &Frontmatter) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for Frontmatter

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,