Skip to main content
← Back to kicad-monkey Rust Docs kicad-monkey Rust Crate API Reference

kicad_monkey_contracts/generated/
board_plot_result.rs

1/// Error types.
2pub mod error {
3    /// Error from a `TryFrom` or `FromStr` implementation.
4    pub struct ConversionError(::std::borrow::Cow<'static, str>);
5    impl ::std::error::Error for ConversionError {}
6    impl ::std::fmt::Display for ConversionError {
7        fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> Result<(), ::std::fmt::Error> {
8            ::std::fmt::Display::fmt(&self.0, f)
9        }
10    }
11    impl ::std::fmt::Debug for ConversionError {
12        fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> Result<(), ::std::fmt::Error> {
13            ::std::fmt::Debug::fmt(&self.0, f)
14        }
15    }
16    impl From<&'static str> for ConversionError {
17        fn from(value: &'static str) -> Self {
18            Self(value.into())
19        }
20    }
21    impl From<String> for ConversionError {
22        fn from(value: String) -> Self {
23            Self(value.into())
24        }
25    }
26}
27///Metadata paired with a separate board plotter-IR JSON byte buffer.
28///
29/// <details><summary>JSON schema</summary>
30///
31/// ```json
32///{
33///  "$id": "urn:wavenumber:schema:kicad_monkey.board_plot.result:a0",
34///  "title": "Board plot result a0",
35///  "description": "Metadata paired with a separate board plotter-IR JSON byte buffer.",
36///  "type": "object",
37///  "required": [
38///    "diagnostics",
39///    "output_bytes",
40///    "total_operations",
41///    "type",
42///    "version"
43///  ],
44///  "properties": {
45///    "diagnostics": {
46///      "type": "array",
47///      "items": {
48///        "$ref": "#/$defs/Diagnostic"
49///      }
50///    },
51///    "output_bytes": {
52///      "type": "string"
53///    },
54///    "total_operations": {
55///      "type": "integer",
56///      "maximum": 4294967295.0,
57///      "minimum": 0.0
58///    },
59///    "type": {
60///      "type": "string",
61///      "const": "kicad_monkey.board_plot.result"
62///    },
63///    "version": {
64///      "type": "string",
65///      "const": "a0"
66///    }
67///  },
68///  "additionalProperties": false
69///}
70/// ```
71/// </details>
72#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
73#[serde(deny_unknown_fields)]
74pub struct BoardPlotResultA0 {
75    pub diagnostics: ::std::vec::Vec<Diagnostic>,
76    pub output_bytes: ::std::string::String,
77    pub total_operations: u32,
78    #[serde(rename = "type")]
79    pub type_: ::std::string::String,
80    pub version: ::std::string::String,
81}
82///Stable operation diagnostic shared by native, Python, and browser adapters.
83///
84/// <details><summary>JSON schema</summary>
85///
86/// ```json
87///{
88///  "description": "Stable operation diagnostic shared by native, Python, and browser adapters.",
89///  "type": "object",
90///  "required": [
91///    "code",
92///    "message",
93///    "phase"
94///  ],
95///  "properties": {
96///    "code": {
97///      "type": "string"
98///    },
99///    "message": {
100///      "type": "string"
101///    },
102///    "phase": {
103///      "$ref": "#/$defs/DiagnosticPhase"
104///    },
105///    "position": {
106///      "$ref": "#/$defs/SourcePosition"
107///    },
108///    "token": {
109///      "type": "string"
110///    }
111///  },
112///  "additionalProperties": false
113///}
114/// ```
115/// </details>
116#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
117#[serde(deny_unknown_fields)]
118pub struct Diagnostic {
119    pub code: ::std::string::String,
120    pub message: ::std::string::String,
121    pub phase: DiagnosticPhase,
122    #[serde(
123        default,
124        deserialize_with = "crate::deserialize_present_nonnull",
125        skip_serializing_if = "::std::option::Option::is_none"
126    )]
127    pub position: ::std::option::Option<SourcePosition>,
128    #[serde(
129        default,
130        deserialize_with = "crate::deserialize_present_nonnull",
131        skip_serializing_if = "::std::option::Option::is_none"
132    )]
133    pub token: ::std::option::Option<::std::string::String>,
134}
135///`DiagnosticPhase`
136///
137/// <details><summary>JSON schema</summary>
138///
139/// ```json
140///{
141///  "type": "string",
142///  "enum": [
143///    "lex",
144///    "tree",
145///    "build"
146///  ]
147///}
148/// ```
149/// </details>
150#[derive(
151    ::serde::Deserialize,
152    ::serde::Serialize,
153    Clone,
154    Copy,
155    Debug,
156    Eq,
157    Hash,
158    Ord,
159    PartialEq,
160    PartialOrd,
161)]
162pub enum DiagnosticPhase {
163    #[serde(rename = "lex")]
164    Lex,
165    #[serde(rename = "tree")]
166    Tree,
167    #[serde(rename = "build")]
168    Build,
169}
170impl ::std::fmt::Display for DiagnosticPhase {
171    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
172        match *self {
173            Self::Lex => f.write_str("lex"),
174            Self::Tree => f.write_str("tree"),
175            Self::Build => f.write_str("build"),
176        }
177    }
178}
179impl ::std::str::FromStr for DiagnosticPhase {
180    type Err = self::error::ConversionError;
181    fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
182        match value {
183            "lex" => Ok(Self::Lex),
184            "tree" => Ok(Self::Tree),
185            "build" => Ok(Self::Build),
186            _ => Err("invalid value".into()),
187        }
188    }
189}
190impl ::std::convert::TryFrom<&str> for DiagnosticPhase {
191    type Error = self::error::ConversionError;
192    fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
193        value.parse()
194    }
195}
196impl ::std::convert::TryFrom<&::std::string::String> for DiagnosticPhase {
197    type Error = self::error::ConversionError;
198    fn try_from(
199        value: &::std::string::String,
200    ) -> ::std::result::Result<Self, self::error::ConversionError> {
201        value.parse()
202    }
203}
204impl ::std::convert::TryFrom<::std::string::String> for DiagnosticPhase {
205    type Error = self::error::ConversionError;
206    fn try_from(
207        value: ::std::string::String,
208    ) -> ::std::result::Result<Self, self::error::ConversionError> {
209        value.parse()
210    }
211}
212///Zero-based UTF-8 byte offset with one-based source coordinates.
213///
214/// <details><summary>JSON schema</summary>
215///
216/// ```json
217///{
218///  "description": "Zero-based UTF-8 byte offset with one-based source coordinates.",
219///  "type": "object",
220///  "required": [
221///    "column",
222///    "line",
223///    "offset"
224///  ],
225///  "properties": {
226///    "column": {
227///      "type": "string"
228///    },
229///    "line": {
230///      "type": "string"
231///    },
232///    "offset": {
233///      "type": "string"
234///    }
235///  },
236///  "additionalProperties": false
237///}
238/// ```
239/// </details>
240#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
241#[serde(deny_unknown_fields)]
242pub struct SourcePosition {
243    pub column: ::std::string::String,
244    pub line: ::std::string::String,
245    pub offset: ::std::string::String,
246}