Crate atelier_assembler[][src]

This crate provides the model assembly capability, to merge files into a single in-memory Model.

A tool can add files one-by-one, or from a directory, and then process them all into a single model. This implementation understands the different registered file extensions so that it can read files in different representations and assemble them seamlessly.

Example

The following is the simple, and most common, method of using the assembler. This uses the default FileTypeRegistry and will search for all models in the set of paths specified in the environment variable “SMITHY_PATH”.

use atelier_assembler::ModelAssembler;
use atelier_core::error::Result;
use atelier_core::model::Model;
use std::convert::TryFrom;

let env_assembler = ModelAssembler::default();

let model: Result<Model> = Model::try_from(env_assembler);

For more information, see the Rust Atelier book.

Structs

FileType

A File type, this has a display name and a reader function.

FileTypeRegistry

A mapping from file extension to file type. Note that FileTypeRegistry::default will always contain at least mappings for “.json” and “.smithy” file types. Note that file extensions will always be compared in a case insensitive manner.

ModelAssembler

Assemble a single model by merging the sub-models represented by one or more files.

Constants

ENV_PATH_NAME

The name of an environment variable, which if present, has a number of paths which should be searched for files by the ModelAssembler.

Type Definitions

FileReader

A Function type used to read a particular format into a model.