1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
/*!
Traits for reading and writing models in different formats. Separate crates implement the ability
to handle different representations, such as the original Smithy, JSON AST, and OpenAPI.
This module also provides a `Debug` implementation of `ModelWriter` to write out the internal
structure. The details of this are shown in the following example.
# Example Model Writer
The example below is pretty much the implementation of the `debug` module, it writes the model
using the `Debug` implementation associated with those objects.
```rust
use atelier_core::io::ModelWriter;
use atelier_core::model::Model;
use atelier_core::error::Result as ModelResult;
use std::io::Write;
#[derive(Debug)]
pub struct Debugger {}
impl Default for Debugger {
fn default() -> Self {
Self {}
}
}
impl ModelWriter for Debugger {
fn write(&mut self, w: &mut impl Write, model: &Model) -> ModelResult<()> {
write!(w, "{:#?}", model)?;
Ok(())
}
}
```
*/
use crateResult as ModelResult;
use crateModel;
use File;
use PathBuf;
// ------------------------------------------------------------------------------------------------
// Public Types
// ------------------------------------------------------------------------------------------------
///
/// Trait implemented to write a model in a specific representation. It is expected that
/// implementations of this trait would ensure that the model is complete unless they can
/// specifically serialize an incomplete model (the Smithy IDL can).
///
///
/// Trait implemented to read a model from a specific representation.
///
// ------------------------------------------------------------------------------------------------
// Public Functions
// ------------------------------------------------------------------------------------------------
///
/// Read a model from the string-like value `s` using the given `ModelReader`. This is simply a
/// short-cut that saves some repetitive boiler-plate.
///
///
/// Read a model from a file path using the given `ModelReader`. This is simply a
/// short-cut that saves some repetitive boiler-plate.
///
///
/// Write the `model` into a string `s` using the given `ModelWriter`. This is simply a
/// short-cut that saves some repetitive boiler-plate.
///
///
/// Write the `model` into a file using the given `ModelWriter`. This is simply a
/// short-cut that saves some repetitive boiler-plate.
///
// ------------------------------------------------------------------------------------------------
// Modules
// ------------------------------------------------------------------------------------------------