mod nodes

module nodes

Module for generating a semi-structured representation of Rust signatures.

The module helps with mapping the content of Rust signatures to the appropriate docutils node type.

Functions

fn nodes_for_abi_opt(abi: &Option<Abi>) -> Vec<Node>

Create nodes for an optional ABI specification.

fn nodes_for_angle_bracket_generic_args(angled_args: &AngleBracketedGenericArguments) -> Vec<Node>

Create nodes for angle bracket generic arguments in paths.

fn nodes_for_bare_fn(bare_fn: &TypeBareFn) -> Vec<Node>

Create nodes for a bare fn type.

fn nodes_for_bound_lifetimes(bound_lts: &BoundLifetimes) -> Vec<Node>

Create nodes for bound lifetimes.

fn nodes_for_expr_lit(expr_lit: &ExprLit) -> Vec<Node>

Create nodes for a literal expression.

fn nodes_for_generic_argument(generic_arg: &GenericArgument) -> Vec<Node>

Create nodes for a generic argument.

fn nodes_for_generic_param(generic_param: &GenericParam) -> Vec<Node>

Create nodes for a generic parameter, along with its bounds.

fn nodes_for_generics(generics: &Generics) -> Vec<Node>

Create nodes for generics declared for an item.

The function does not create nodes for the where clause of the generics. Use nodes_for_where_clause to generate nodes for it.

fn nodes_for_lifetime_param(lifetime_param: &LifetimeParam) -> Vec<Node>

Create nodes for a lifetime parameter.

fn nodes_for_parenthesized_generic_args(paren_args: &ParenthesizedGenericArguments) -> Vec<Node>

Create nodes for parenthesized generic arguments in paths.

fn nodes_for_pat(pat: &Pat) -> Vec<Node>

Create nodes for a pattern binding.

fn nodes_for_pat_type(pat_type: &PatType) -> Vec<Node>

Create nodes for a type pattern binding.

fn nodes_for_path(path: &Path) -> Vec<Node>

Create nodes for a path.

fn nodes_for_path_segment(segment: &PathSegment, make_link: bool) -> Vec<Node>

Create nodes for a path segment.

fn nodes_for_return_type(return_type: &ReturnType) -> Vec<Node>

Create nodes for the return type of function.

fn nodes_for_type(ty: &Type) -> Vec<Node>

Create nodes for a type specification.

fn nodes_for_type_param(type_param: &TypeParam) -> Vec<Node>

Create nodes for a type parameter, along with its bounds.

fn nodes_for_type_param_bound(type_param_bound: &TypeParamBound) -> Vec<Node>

Create nodes for a type parameter binding.

fn nodes_for_type_param_bounds(type_param_bounds: &Punctuated<TypeParamBound, ?>) -> Vec<Node>

Create nodes for all type parameters in a binding.

fn nodes_for_where_clause(where_clause: &WhereClause) -> Vec<Node>

Create nodes for the where clause of generics for an item.

The created nodes will insert a newline node as the first node, and between each predicate.

fn type_name(ty: &Type) -> String

Get simple name for a type.

The simple name is the name without any generic arguments.

fn type_param_bound_name(type_param_bound: &TypeParamBound) -> String

Get simple name for a type parameter bound.

The simple name is the name without any generic arguments.

fn type_path_name(type_path: &TypePath) -> String

Get simple name for a type path.

The simple name is essentially the path created from the identifiers of each segment of the type path.

Enums

enum Node

Enum representing various docutils nodes for item signatures

Name(String)

The node for a name in the signature.

A node for link to another item in the signature.

Keyword(&'static str)

A node for a keyword in the signature.

Punctuation(&'static str)

A node for a punctuation in the signature.

Space

A node for a single space in the signature.

Newline

A node for a newline in the signature.

Indent

A node for adding an indentation before the line.

Operator(&'static str)

A node for an operator in the signature.

Returns

A node for the returns symbol.

Literal(String)

A literal string to include in the signature.

Lifetime(String)

A node for a lifetime name. This is not a docutils node, but kept separate for easier identification.

Traits implemented

impl Serialize for Node

Functions

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
    S: Serializer