pub struct Documentation(/* private fields */);
Expand description
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§
Source§impl Documentation
impl Documentation
Sourcepub fn leaf_empty() -> Documentation
pub fn leaf_empty() -> Documentation
Creates a leaf node of the documentation, without any description.
Sourcepub fn leaf(ty: impl Into<Text>) -> Documentation
pub fn leaf(ty: impl Into<Text>) -> Documentation
Creates a leaf node with the given type.
Note that an empty ty
is equivalent to the leaf_empty
.
Sourcepub fn with_arity(self, arity: Arity) -> Self
pub fn with_arity(self, arity: Arity) -> Self
Wraps a node into an array or a set.
This describes a homogeneous collection.
Sourcepub fn map(key: Documentation, value: Documentation) -> Self
pub fn map(key: Documentation, value: Documentation) -> Self
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.
Sourcepub fn struct_(
fields: impl IntoIterator<Item = (impl Into<Text>, Field)>,
) -> Self
pub fn struct_( fields: impl IntoIterator<Item = (impl Into<Text>, Field)>, ) -> Self
Builds a struct.
Builds a structure, provided a list of fields.
The iterator should yield pairs of (name, field).
Sourcepub fn enum_(
variants: impl IntoIterator<Item = (impl Into<Text>, Field)>,
tagging: Tagging,
) -> Self
pub fn enum_( variants: impl IntoIterator<Item = (impl Into<Text>, Field)>, tagging: Tagging, ) -> Self
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§
Source§impl Clone for Documentation
impl Clone for Documentation
Source§fn clone(&self) -> Documentation
fn clone(&self) -> Documentation
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more