Atelier: crate atelier_describe
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.
Examples
The following demonstrates how to use the describe_model
function.
use Model;
# use Version;
use describe_model;
use ;
#
let model = make_model;
let documentation = describe_model.unwrap;
let doc_string = write_document_to_string.unwrap;
The following example demonstrates the ModelWriter
trait and outputs the documentation to
stdout.
use Model;
use ModelWriter;
# use Version;
use ;
use ;
use stdout;
#
let model = make_model;
let mut writer = new;
let documentation = writer.write.unwrap;
Changes
Version 0.1.1
- Fixed: removed local path dependency for
somedoc
.
Version 0.1.0
This initial version is reasonably usable, although incomplete.
TODO
- Complete both prelude, and custom, trait output.
- Test cases.