Enum rhai_autodocs::doc_item::DocItem

source ·
pub enum DocItem {
    Function {
        root_metadata: FunctionMetadata,
        metadata: Vec<FunctionMetadata>,
        name: String,
        index: usize,
    },
    CustomType {
        metadata: CustomTypesMetadata,
        index: usize,
    },
}
Expand description

Generic representation of documentation for a specific item. (a function, a custom type, etc.)

Variants§

§

Function

Fields

§root_metadata: FunctionMetadata
§name: String
§index: usize
§

CustomType

Fields

§index: usize

Implementations§

source§

impl DocItem

source

pub fn new_function( metadata: &[FunctionMetadata], name: &str, namespace: &str, options: &Options ) -> Result<Option<Self>, AutodocsError>

source

pub fn new_custom_type( metadata: CustomTypesMetadata, namespace: &str, options: &Options ) -> Result<Option<Self>, AutodocsError>

source

pub fn index(&self) -> usize

source

pub fn name(&self) -> &str

source

pub fn find_index( name: &str, namespace: &str, doc_comments: &[String] ) -> Result<Option<usize>, AutodocsError>

Find the order index of the item by searching for the index pattern.

source

pub fn format_comments(doc_comments: &[String]) -> String

Format the function doc comments to make them into readable markdown.

source

pub fn remove_extra_tokens(dc: Vec<String>) -> Vec<String>

Remove crate specific comments, like rhai-autodocs:index.

source

pub fn fmt_doc_comments(dc: String) -> String

Remove doc comments identifiers.

source

pub fn remove_test_code(doc_comments: &str) -> String

NOTE: mdbook handles this automatically, but other markdown processors might not. Remove lines of code that starts with the ‘#’ token, which are removed on rust docs automatically.

Trait Implementations§

source§

impl Clone for DocItem

source§

fn clone(&self) -> DocItem

Returns a copy 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 DocItem

source§

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

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

impl Serialize for DocItem

source§

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

Serialize this value into the given Serde serializer. 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> 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,

§

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>,

§

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>,

§

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.