Skip to main content

DocBinding

Struct DocBinding 

Source
pub struct DocBinding {
    pub kept: KeptDocs,
    pub skips: for<'a, 'b> fn(&Node<'a>, Ancestors<'a, 'b>) -> bool,
    pub forward: for<'a, 'b> fn(&Node<'a>, &[u8], Ancestors<'a, 'b>) -> bool,
    pub gathers: Option<fn(&Node<'_>, &[u8]) -> bool>,
}
Expand description

Re-exported because the LOC metric bills documentation through them — Go, Ruby and Lua runs by position, and the doc comments a bound language’s tool attaches — while the predicates beside them stay crate-private. Re-exported because the LOC metric bills documentation through them — Go, Ruby and Lua runs by position, and the doc comments a bound language’s tool attaches — while the predicates beside them stay crate-private. Re-exported because the LOC metric bills documentation through them — Go, Ruby and Lua runs by position, and the doc comments a bound language’s tool attaches — while the predicates beside them stay crate-private. How a language’s tool attaches a doc comment to the declaration after it (#1613), read from each tool’s source rather than its manual (lesson 98); see [Checker::DOC_BINDING]. A forward doc comment that the binding does not attach documents nothing and is billed as a plain comment.

The doc comments compared are those of one stretch: the comment siblings between two other siblings, read past the ones skips names. Blank rows never split a stretch; none of the bound tools reads them.

Fields§

§kept: KeptDocs

Which doc comments of a stretch the tool attaches.

§skips: for<'a, 'b> fn(&Node<'a>, Ancestors<'a, 'b>) -> bool

A sibling that may sit between a doc comment and its target without detaching it, so a stretch reads past it: rustc gives an item every outer doc comment above it, through its other attributes. A grammar that nests annotations inside the declaration has nothing to skip. A skipped node is never a target. The Ancestors are the node’s chain.

§forward: for<'a, 'b> fn(&Node<'a>, &[u8], Ancestors<'a, 'b>) -> bool

Whether a doc comment documents what follows it. false leaves it to where it sits, as in an unbound language: Rust’s inner //! documents the item enclosing it, a doc comment in a macro token tree documents whatever the expansion makes of it, and a KDoc inside a Kotlin declaration’s signature is read by findDocComment from there. The Ancestors are the comment’s chain.

§gathers: Option<fn(&Node<'_>, &[u8]) -> bool>

A doc comment that documents an entry of its own and takes with it the forward doc comments before it in its stretch, so they document even when the stretch ends at no target: Doxygen gives a \file block the doc blocks it has gathered since the last entry, so a licence block above one at the end of a header documents the file. It should not itself bind forward. Where the stretch does end at a target, kept alone decides. None for a tool with no such block, which lets a stretch that ends at no target return before it is even collected.

Implementations§

Source§

impl DocBinding

Source

pub const fn new(kept: KeptDocs) -> Self

A binding that keeps kept, skips no sibling, binds every doc comment forward, and has no doc comment gather the others.

Trait Implementations§

Source§

impl Clone for DocBinding

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 Copy for DocBinding

Source§

impl Debug for DocBinding

Source§

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

Formats the value using the given formatter. 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.