Provides the ability to write documentation for Smithy models.
This crate provides two mechanisms for generating human-readable documentation for a Smithy model using the crate somedoc.
Firstly, the DocumentationWriter
structure implements the atelier_core::io::ModelWriter
trait and so may be used
in the same manner as other model writers. The ModelWriter::new
function takes an argument that will denote the
format to produce, but provides little other control over the generation. Internally this writer implementation calls
the following function.
The function describe_model
will produce a somedoc::model::Document
instance from a atelier_core::modrel::Model
.
This instance may then be rendered according to the writers provided by somedoc. This provides complete control over
the actual formatting step, and the same generated Document may be written multiple times if required.
The following demonstrates how to use the describe_model
function.
```rust use atelier_core::model::Model;
use atelierdescribe::describemodel; use somedoc::write::{writedocumentto_string, OutputFormat};
let model = makemodel(); let documentation = describemodel(&model).unwrap();
let docstring = writedocumenttostring(&documentation, OutputFormat::Html).unwrap(); ```
The following example demonstrates the ModelWriter
trait and outputs the documentation to
stdout.
```rust use ateliercore::model::Model; use ateliercore::io::ModelWriter;
use atelierdescribe::{describemodel, DocumentationWriter}; use somedoc::write::{writedocumentto_string, OutputFormat}; use std::io::stdout;
let model = make_model(); let mut writer = DocumentationWriter::new(OutputFormat::Html); let documentation = writer.write(&mut stdout(), &model).unwrap(); ```
Version 0.1.1
somedoc
.Version 0.1.0
This initial version is reasonably usable, although incomplete.