Skip to main content

AdrDoc

Struct AdrDoc 

Source
pub struct AdrDoc {
    pub meta: AdrMeta,
    pub path: String,
    pub sections: Vec<Section>,
    pub preamble: String,
    pub links: Vec<WikiLink>,
    pub versions: VersionFacts,
}
Expand description

A fully-parsed ADR: metadata, section structure, and authored links.

Fields§

§meta: AdrMeta

Frontmatter metadata.

§path: String

Repository-relative path of the ADR file.

§sections: Vec<Section>

## sections in document order.

§preamble: String

The body text before the first ## heading — in house style, the # title and the summary table — verbatim and uncapped, with surrounding blank lines trimmed (the same rule the sections use, see Section::text).

This is the only part of an ADR that belongs to no section, which is exactly why the adr node carries it and not the whole document: the sections already hold the body between them, so nothing is stored twice. The whole document, for a reader who wants it, is on the file: node.

§links: Vec<WikiLink>

Authored [[…]] links in document order.

§versions: VersionFacts

What the document says about its own version, in three places.

Implementations§

Source§

impl AdrDoc

Source

pub fn key(&self) -> String

The natural key of this ADR’s node (adr:<id>).

Source

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

The full, uncapped text the node key should show, or None if key names no part of this ADR (or names an empty one).

The inverse of the key grammar Self::key and Self::facts build, and deliberately their neighbour: a renderer that re-split adr:0015#consequences with its own rule would be reimplementing the thing it is trying to read.

The split is the point. adr:0015 gets its preamble and a section gets its own span — never the whole document, which is what a path-only rule would hand to all twenty ADR notes and all 179 section notes alike, beside the file: note that already carries it once.

Source

pub fn facts(&self) -> FactSet

The authored nodes and structural edges for this ADR: an adr node, one adr_section node per section, and contains edges between them. Wiki links are not included — they are validated against the code graph by [crate::check] before becoming edges.

Trait Implementations§

Source§

impl Clone for AdrDoc

Source§

fn clone(&self) -> AdrDoc

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 AdrDoc

Source§

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

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

impl Eq for AdrDoc

Source§

impl PartialEq for AdrDoc

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for AdrDoc

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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. 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> 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.