[−][src]Module atelier_core::model
The core model itself, consisting of shapes, members, types, values, and model statements.
Model Naming Conventions
As the majority of the structures in the core model are simply data carrying representations it is useful to have a set of patterns for how different fields are accessed in these structures. The following are the general patterns.
For property version of type T
(required, single value):
fn version(&self) -> T;
returns a reference to the current value.fn set_version(&self, v: T);
sets the current value.
For property input of type Option<T>
(optional, single value):
fn has_input(&self) -> bool;
returnstrue
if the value isSome(T)
, elsefalse
.fn input(&self) -> &Option<T>;
returns a reference to the current value.fn set_input(&self, v: T);
sets the current value.fn unset_input(&self);
sets the current value toNone
.
For property traits of type Vec<T>
(multi-valued, no identity):
fn has_traits(&self) -> bool;
returnstrue
if there are any values in the vector, elsefalse
.fn traits(&self) -> impl Iterator<Item = &T>;
returns an iterator over all the items in the vector.fn add_trait(&mut self, v: T);
add (push) the value into the vector.fn append_traits(&mut self, vs: &[T]);
add all the elements from the slice usingadd_trait
.fn remove_trait(&mut self, v: &T);
remove all traits that are equal to the provided value from the vector.
For property references of type HashSet<T>
(multi-valued, with identity):
fn has_references(&self) -> bool;
returnstrue
if there are any values in the set, elsefalse
.fn has_reference(&self, v: &T) -> bool;
returnstrue
if the set contains the provided value, elsefalse
.fn references(&self) -> impl Iterator<Item = &T>;
returns an iterator over all the items in the set.fn add_reference(&mut self, v: T);
add (insert) the value into the set.fn append_references(&mut self, vs: &[T]);
add all the elements from the slice usingadd_reference
.fn remove_reference(&mut self, v: &T);
remove the provided value from the set.
For property shapes of type HashMap<K, V> where V: Named<I>
(a map of identity to value):
fn has_shapes(&self) -> bool;
returnstrue
if there are any values in the map, elsefalse
.fn has_shape(&self, k: &K) -> bool;
returnstrue
if the map contains the provided key value, elsefalse
.fn shapes(&self) -> impl Iterator<Item = (&K, &V)>;
returns an iterator over all the items in the map.fn add_shape(&mut self, k: K, v: V);
add (insert) the value into the map.fn append_shapes(&mut self, v: &[V]);
add all the elements from the slice usingadd_shape
.fn remove_shape(&mut self, k: &K);
remove any entry from the map with the provided key.
Modules
builder | Builders to construct models in a more fluent style. See the example in the library overview. |
shapes | Model structures common across all shape types. |
values | Model structures for values, these are used to capture the right-hand side of member declarations within shapes, but only shape IDs, as well as the values provided to trait applications and metadata statements. |
Structs
Identifier | A component of |
Model | The core model structure, this corresponds to a single Smithy file according to the specification. It contains: |
Namespace | A component of |
ShapeID | The complete shape identifier type used across model structures, it is qualified with a namespace and may also include an inner member identifier. |
Traits
Annotated | A trait implemented by model elements that may have traits applied to them. |
Named | A trait implemented by model elements that have a strong name/identity. Note that identity is
immutable, no model element has a |