Skip to main content

HeadMeta

Struct HeadMeta 

Source
pub struct HeadMeta {
    pub declared: Vec<(String, Vec<String>)>,
    pub title: Option<String>,
    pub description: Option<String>,
    pub author: Option<String>,
    pub category: Option<String>,
    pub tags: Vec<String>,
    pub published: Option<Value>,
    pub modified: Option<Value>,
}
Expand description

What a document declares about itself, in a standard vocabulary its format provides — HTML’s <head> (the meta name/property pairs, title, the lang attribute, the canonical link, rel="tag" links) and a schema.org JSON-LD block. Two layers: every declaration lands verbatim under ::::name (::::description, ::::og:type, ::::article:section, ::::schema:@type), so nothing a page says is lost; and the standard vocabularies feed a curated core — the tags (keywords, article:tag, rel=tag, JSON-LD keywords) become traits on the document and ::tags, the one classification (article:section / articleSection) becomes ::category and a trait too, description, author, and the published / modified instants. Declared identity only: a format adapter reads a cited vocabulary, never a class name or a layout.

Fields§

§declared: Vec<(String, Vec<String>)>

Every declaration, name → values, in document order; a repeated name accumulates.

§title: Option<String>§description: Option<String>§author: Option<String>§category: Option<String>

The one classification (a section of the site, a category).

§tags: Vec<String>

The tags, as written, first appearance wins.

§published: Option<Value>§modified: Option<Value>

Implementations§

Source§

impl HeadMeta

Source

pub fn declare(&mut self, name: &str, value: &str)

Record a declaration verbatim (the lossless layer).

Source

pub fn tag(&mut self, tag: &str)

Add a tag unless already present (case-insensitively).

Source

pub fn declared_value(&self, name: &str) -> Option<Value>

A declaration’s value: the string when declared once, the list when repeated.

Source

pub fn trait_name(s: &str) -> String

The trait spelling of a tag or category: as declared, case kept, with runs of anything a name cannot carry (spaces, slashes, parentheses) collapsed to one dash — Execution Model is <tag:Execution-Model>, now() is <tag:now>.

Trait Implementations§

Source§

impl Clone for HeadMeta

Source§

fn clone(&self) -> Self

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 HeadMeta

Source§

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

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

impl Default for HeadMeta

Source§

fn default() -> Self

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

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> 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 = !

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

fn try_from(value: U) -> Result<T, !>

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.