Crate atelier_smithy[−][src]
Expand description
Provides the ability to read and write Smithy models in their own native language representation.
The crate provides two low-level parsers, parse_model
and parse_selector
that correspond to the
core Model
and Selector
types. These are decouple to allow for the tool use cases where it is
unnecessary or even undesirable to parse all selector expressions as well as those cases where
selector expressions may be useful in non-model scenarios.
This crate also provides implementations of both the core ModelReader
and ModelWriter
traits
for Smithy IDL files.
Example - Model
The following demonstrates the SmithyReader
to parse a file into the in-memory model.
use atelier_core::io::read_model_from_file; use atelier_smithy::SmithyReader; use std::path::PathBuf; let path = PathBuf::from("tests/good/waiters.smithy"); let mut reader = SmithyReader::default(); let result = read_model_from_file(&mut reader, path); assert!(result.is_ok());
Example - Selector
The following example parses the simple selector expression "*"
, denoting any shape, into it’s
in-memory model.
use atelier_smithy::parse_selector; let result = parse_selector("*"); assert!(result.is_ok());
Structs
Read a Model from the Smithy native representation.
Write a Model in the Smithy native representation.
Constants
The file extension used by Smithy IDL files.
The name to report in errors in this representation.
Functions
Parse a Smithy model from the Smithy IDL representation.
Parse a Smithy selector expression. These are not parsed by default when reading a Smithy model as the selectors are not necessarily required for all processing cases.