Skip to main content

KeptDocs

Enum KeptDocs 

Source
pub enum KeptDocs {
    All,
    Last {
        joins: fn(&Node<'_>, &Node<'_>, &[u8]) -> bool,
    },
    Nearest {
        hidden: fn(&Node<'_>, &Node<'_>) -> bool,
    },
    Leading {
        hidden: fn(&Node<'_>, &[u8]) -> bool,
        joins: fn(&Node<'_>, &Node<'_>, &[u8]) -> bool,
        after_code: fn(&Node<'_>) -> 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. Which doc comments of a stretch a DocBinding attaches.

Variants§

§

All

Every doc comment of the stretch: rustc gives an item all the outer doc comments above it, across blank rows, plain comments and other attributes, which rustdoc concatenates.

§

Last

The last doc comment before the declaration’s first token, and the doc comments before it that joins(earlier, later, code) makes one comment with it: javac’s Token::docComment and Kotlin’s PrecedingDocCommentsBinder keep the last, and javac’s dangling-doc-comments lint names the rest. A skipped node is that first token, a Kotlin annotation the grammar leaves outside its declaration; when no doc comment precedes it, the first one after it is read, as findDocComment reads Kotlin’s modifier list.

Fields

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

Whether two adjacent doc comments are one to the tool.

§

Nearest

The stretch’s last comment, if it is a doc comment: Groovy’s GroovydocManager reads the comment nearest the declaration and drops it unless it opens /**, so a plain comment in between detaches it. A comment for which hidden(comment, next) holds, next being the sibling after it, is invisible to the tool and read past.

Fields

§hidden: fn(&Node<'_>, &Node<'_>) -> bool

Whether the tool cannot see a comment.

§

Leading

What a reverse scan over the declaration’s leading trivia keeps, from its first token back: past the comments and skipped nodes hidden(node, code) names to the nearest other comment, kept if it is a doc comment, then on over the doc comments directly before it that joins(earlier, later, code) makes one with it. A member directly before them that is hidden or plain ends the run. A skipped node hidden does not name is the first token — a decorator the grammar leaves outside its declaration — so a doc comment after it documents nothing. Roslyn’s GetDocumentationCommentTriviaFromSyntaxNode reads past plain comments and directives and keeps adjacent doc comments; JSDoc’s getLeadingJsdocComment reads past line comments only; tsc reads past every plain comment.

Fields

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

Whether the scan reads past a member to the one before it.

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

Whether two adjacent doc comments are one to the tool.

§after_code: fn(&Node<'_>) -> bool

Whether the tool reads a member on the row where the code before the stretch ends, asked of the target. tsc’s getLeadingCommentRanges starts at the line break after the token before the declaration, so x; /** d */ documents nothing after it, except before a parameter, whose trailing comment ranges it reads too; Roslyn and JSDoc read it.

Trait Implementations§

Source§

impl Clone for KeptDocs

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 KeptDocs

Source§

impl Debug for KeptDocs

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.