[][src]Struct structdoc::Documentation

pub struct Documentation(_);

A representation of documentation.

This carries the internal representation (tree) of a documentation. Note that currently this does not support cycles or referencing other branches.

This can be either queried by the StructDoc trait, or manually constructed (which might be needed in a manual implementation of the trait).

TODO

Currently, the documentation can be formatted both with the Debug and Display traits, but doesn't offer any kind of customization. In the future it should be possible to both traverse the structure manually and to customize the way the documentation is formatted.

Implementations

impl Documentation[src]

pub fn leaf_empty() -> Documentation[src]

Creates a leaf node of the documentation, without any description.

pub fn leaf(ty: impl Into<Text>) -> Documentation[src]

Creates a leaf node with the given type.

Note that an empty ty is equivalent to the leaf_empty.

pub fn set_flag(&mut self, flag: Flags)[src]

Adds a flag to this documentation node.

pub fn with_arity(self, arity: Arity) -> Self[src]

Wraps a node into an array or a set.

This describes a homogeneous collection.

pub fn map(key: Documentation, value: Documentation) -> Self[src]

Builds a map.

Joins documentation of keys and values into a map. Note that all the keys and all the values are of the same type ‒ for heterogeneous things, you might want structs or enums.

pub fn struct_(
    fields: impl IntoIterator<Item = (impl Into<Text>, Field)>
) -> Self
[src]

Builds a struct.

Builds a structure, provided a list of fields.

The iterator should yield pairs of (name, field).

pub fn enum_(
    variants: impl IntoIterator<Item = (impl Into<Text>, Field)>,
    tagging: Tagging
) -> Self
[src]

Builds an enum.

Builds an enum from provided list of fields. The fields may be either leaves (without things inside ‒ created with eg. leaf_empty), newtypes (other leaves) or structs. The iterator should yield pairs of (name, variant).

See the serde documentation about enum representations for tagging.

Trait Implementations

impl Clone for Documentation[src]

impl Debug for Documentation[src]

impl Display for Documentation[src]

Auto Trait Implementations

impl RefUnwindSafe for Documentation

impl Send for Documentation

impl Sync for Documentation

impl Unpin for Documentation

impl UnwindSafe for Documentation

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.