Skip to main content

SyntaxKind

Enum SyntaxKind 

Source
pub enum SyntaxKind {
Show 48 variants NAME, TYPE, COLON, DESCRIPTION, OPEN_BRACKET, CLOSE_BRACKET, OPTIONAL, BODY_TEXT, SUMMARY, EXTENDED_SUMMARY, STRAY_LINE, WARNING_TYPE, UNDERLINE, DIRECTIVE_MARKER, KEYWORD, DOUBLE_COLON, VERSION, RETURN_TYPE, DEFAULT_KEYWORD, DEFAULT_SEPARATOR, DEFAULT_VALUE, NUMBER, CONTENT, GOOGLE_DOCSTRING, GOOGLE_SECTION, GOOGLE_SECTION_HEADER, GOOGLE_ARG, GOOGLE_RETURNS, GOOGLE_YIELDS, GOOGLE_EXCEPTION, GOOGLE_WARNING, GOOGLE_SEE_ALSO_ITEM, GOOGLE_ATTRIBUTE, GOOGLE_METHOD, PLAIN_DOCSTRING, NUMPY_DOCSTRING, NUMPY_SECTION, NUMPY_SECTION_HEADER, NUMPY_DEPRECATION, NUMPY_PARAMETER, NUMPY_RETURNS, NUMPY_YIELDS, NUMPY_EXCEPTION, NUMPY_WARNING, NUMPY_SEE_ALSO_ITEM, NUMPY_REFERENCE, NUMPY_ATTRIBUTE, NUMPY_METHOD,
}
Expand description

Node and token kinds for all docstring styles.

Google and NumPy variants coexist in a single enum, just as Biome puts JsIfStatement and TsInterface in one SyntaxKind.

Variants§

§

NAME

Section name, parameter name, exception type name, etc.

§

TYPE

Type annotation.

§

COLON

: separator.

§

DESCRIPTION

Description text.

§

OPEN_BRACKET

Opening bracket: (, [, {, or <.

§

CLOSE_BRACKET

Closing bracket: ), ], }, or >.

§

OPTIONAL

optional marker.

§

BODY_TEXT

Free-text section body.

§

SUMMARY

Summary line.

§

EXTENDED_SUMMARY

Extended summary paragraph.

§

STRAY_LINE

Stray line between sections.

§

WARNING_TYPE

Warning type (e.g. UserWarning).

§

UNDERLINE

Section header underline (----------).

§

DIRECTIVE_MARKER

RST directive marker (..).

§

KEYWORD

Keyword such as deprecated.

§

DOUBLE_COLON

RST double colon (::).

§

VERSION

Deprecation version string.

§

RETURN_TYPE

Return type (NumPy-style).

§

DEFAULT_KEYWORD

default keyword.

§

DEFAULT_SEPARATOR

Default value separator (= or :).

§

DEFAULT_VALUE

Default value text.

§

NUMBER

Reference number.

§

CONTENT

Reference content text.

§

GOOGLE_DOCSTRING

Root node for a Google-style docstring.

§

GOOGLE_SECTION

A complete Google section (header + body items).

§

GOOGLE_SECTION_HEADER

Section header (Args:, Returns:, etc.).

§

GOOGLE_ARG

A single argument entry.

§

GOOGLE_RETURNS

A single return value entry.

§

GOOGLE_YIELDS

A single yield value entry.

§

GOOGLE_EXCEPTION

A single exception entry.

§

GOOGLE_WARNING

A single warning entry.

§

GOOGLE_SEE_ALSO_ITEM

A single “See Also” item.

§

GOOGLE_ATTRIBUTE

A single attribute entry.

§

GOOGLE_METHOD

A single method entry.

§

PLAIN_DOCSTRING

Root node for a plain docstring (summary/extended summary only, no NumPy or Google style section markers). Also used for unrecognised styles such as Sphinx.

§

NUMPY_DOCSTRING

Root node for a NumPy-style docstring.

§

NUMPY_SECTION

A complete NumPy section (header + body items).

§

NUMPY_SECTION_HEADER

Section header (name + underline).

§

NUMPY_DEPRECATION

Deprecation directive block.

§

NUMPY_PARAMETER

A single parameter entry.

§

NUMPY_RETURNS

A single return value entry.

§

NUMPY_YIELDS

A single yield value entry.

§

NUMPY_EXCEPTION

A single exception entry.

§

NUMPY_WARNING

A single warning entry.

§

NUMPY_SEE_ALSO_ITEM

A single “See Also” item.

§

NUMPY_REFERENCE

A single reference entry.

§

NUMPY_ATTRIBUTE

A single attribute entry.

§

NUMPY_METHOD

A single method entry.

Implementations§

Source§

impl SyntaxKind

Source

pub const fn is_node(self) -> bool

Whether this kind represents a node (branch) rather than a token (leaf).

Source

pub const fn is_token(self) -> bool

Whether this kind represents a token (leaf) rather than a node (branch).

Source

pub const fn name(self) -> &'static str

Display name for pretty-printing (e.g. "GOOGLE_ARG", "NAME").

Trait Implementations§

Source§

impl Clone for SyntaxKind

Source§

fn clone(&self) -> SyntaxKind

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SyntaxKind

Source§

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

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

impl Display for SyntaxKind

Source§

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

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

impl Hash for SyntaxKind

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for SyntaxKind

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for SyntaxKind

Source§

impl Eq for SyntaxKind

Source§

impl StructuralPartialEq for SyntaxKind

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.