Skip to main content

Contract

Struct Contract 

Source
pub struct Contract {
    pub frontmatter: Option<FrontmatterSpec>,
    pub body: Option<SectionSeq>,
    pub rules: Vec<Box<dyn DocRule>>,
    pub description: Option<String>,
}
Expand description

A compiled contract for one markdown class: frontmatter schema, body grammar, and doc-scoped rules.

Fields§

§frontmatter: Option<FrontmatterSpec>

validated by the frontmatter plane (frontmatter/* findings)

§body: Option<SectionSeq>

the heading grammar of the document body

§rules: Vec<Box<dyn DocRule>>

cross-plane rules over the whole projected tree

§description: Option<String>

the contract root’s description:, the Finding.hint of a finding with no nearer description in scope

Implementations§

Source§

impl Contract

Source

pub fn new() -> Self

An empty contract: no frontmatter schema, no body grammar and no rules.

Source

pub fn body(self, body: SectionSeq) -> Self

Set the body grammar.

Source

pub fn doc_rule(self, rule: Box<dyn DocRule>) -> Self

Attach a doc-scoped rule.

Source

pub fn frontmatter(self, spec: FrontmatterSpec) -> Self

Set the frontmatter schema.

Trait Implementations§

Source§

impl Default for Contract

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> 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, 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.