Crates.io | atelier_describe |
lib.rs | atelier_describe |
version | 0.1.10 |
source | src |
created_at | 2021-02-16 15:55:30.727453 |
updated_at | 2021-07-02 17:58:46.199489 |
description | Rust native documentation generator for the AWS Smithy IDL. |
homepage | |
repository | https://github.com/johnstonskj/rust-atelier.git |
max_upload_size | |
id | 356013 |
size | 69,601 |
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.
use atelier_core::model::Model;
use atelier_describe::describe_model;
use somedoc::write::{write_document_to_string, OutputFormat};
let model = make_model();
let documentation = describe_model(&model).unwrap();
let doc_string = write_document_to_string(&documentation, OutputFormat::Html).unwrap();
The following example demonstrates the ModelWriter
trait and outputs the documentation, in
CommonMark format, to stdout.
use atelier_core::model::Model;
use atelier_core::io::ModelWriter;
use atelier_describe::DocumentationWriter;
use std::io::stdout;
let model = make_model();
let mut writer = DocumentationWriter::default();
let documentation = writer.write(&mut stdout(), &model).unwrap();
Version 0.1.10
Version 0.1.9
Version 0.1.8
Version 0.1.7
Version 0.1.6
Version 0.1.5
Version 0.1.4
Version 0.1.3
DocumentationWriter
so that it only emits CommonMark, more closely aligned with Smithy IDL.Version 0.1.1
Version 0.1.1
somedoc
.Version 0.1.0
This initial version is reasonably usable, although incomplete.