mod function_directive

module function_directive

Implementation of the rust:function directive

Macros

macro func_from_item

DRY macro to parse the different item types.

Functions

fn nodes_for_fn_signature(signature: &Signature) -> Vec<Node>

Generate docutils node layout for the function from its signature

Structs and Unions

struct FunctionDirective

Struct to hold data for documenting a function.

name: String

The full Rust path of the function.

ident: String

The identifier of the function.

options: Vec<DirectiveOption>

The directive options to use.

content: Vec<String>

The docstring for the function.

Implementations

impl FunctionDirective

Variables

const DIRECTIVE_NAME: &'static str

Functions

fn change_parent(&mut self, new_parent: &str)

Change the parent directive of the function.

fn directive_visibility(&self) -> &DirectiveVisibility

Return the visibility of this directive.

fn from_extern(parent_path: &str, item: &ForeignItemFn) -> Directive

Create a new Directive::Function from a syn::ForeignItemFn.

Args:
parent_path:

The full path of the trait the function is in.

item:

The syn::ForeignItemFn reference to parse.

inherited_visibility:

The visibility of the parent module.

Returns:

A new Directive::Function value, which contains the parsed FunctionDirective in it.

fn from_impl_item(parent_path: &str, item: &ImplItemFn, inherited_visibility: &Option<&Visibility>) -> Directive

Create a new Directive::Function from a syn::ImplItemFn.

Args:
parent_path:

The full path of the impl block the function is in.

item:

The syn::ImplItemFn reference to parse.

inherited_visibility:

The visibility of the impl block.

Returns:

A new Directive::Function value, which contains the parsed FunctionDirective in it.

fn from_item(parent_path: &str, item: &ItemFn) -> Directive

Create a new Directive::Function from a syn::ItemFn.

Args:
parent_path:

The full path of the module the function is in.

item:

The syn::ItemFn reference to parse.

inherited_visibility:

The visibility of the parent module.

Returns:

A new Directive::Function value, which contains the parsed FunctionDirective in it.

fn from_trait_item(parent_path: &str, item: &TraitItemFn, inherited_visibility: &Option<&Visibility>) -> Directive

Create a new Directive::Function from a syn::TraitItemFn.

Args:
parent_path:

The full path of the trait the function is in.

item:

The syn::TraitItemFn reference to parse.

inherited_visibility:

The visibility of the trait.

Returns:

A new Directive::Function value, which contains the parsed FunctionDirective in it.

Traits implemented

impl RstDirective for FunctionDirective

Functions

fn get_rst_text(self, level: usize, max_visibility: &DirectiveVisibility) -> Vec<String>
impl MdDirective for FunctionDirective

Functions

fn get_md_text(self, fence_size: usize, max_visibility: &DirectiveVisibility) -> Vec<String>