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

kicad_monkey_contracts/generated/
schematic_plot_request.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///Schematic plot operation. Source bytes are out of band.
28///
29/// <details><summary>JSON schema</summary>
30///
31/// ```json
32///{
33///  "$id": "urn:wavenumber:schema:kicad_monkey.schematic_plot.request:a0",
34///  "title": "Schematic plot request a0",
35///  "description": "Schematic plot operation. Source bytes are out of band.",
36///  "type": "object",
37///  "required": [
38///    "default_line_width_nm",
39///    "sheet_count",
40///    "sheet_index",
41///    "sheet_name",
42///    "sheet_path",
43///    "text_offset_ratio",
44///    "type",
45///    "version",
46///    "worksheet_mode"
47///  ],
48///  "properties": {
49///    "default_line_width_nm": {
50///      "$ref": "#/$defs/SchematicDefaultLineWidthNm"
51///    },
52///    "document_id": {
53///      "type": "string"
54///    },
55///    "sheet_count": {
56///      "$ref": "#/$defs/SchematicPositiveUint32"
57///    },
58///    "sheet_index": {
59///      "$ref": "#/$defs/SchematicPositiveUint32"
60///    },
61///    "sheet_name": {
62///      "type": "string"
63///    },
64///    "sheet_path": {
65///      "type": "string"
66///    },
67///    "source_path": {
68///      "type": "string"
69///    },
70///    "text_offset_ratio": {
71///      "$ref": "#/$defs/SchematicTextOffsetRatio"
72///    },
73///    "text_variables": {
74///      "type": "array",
75///      "items": {
76///        "$ref": "#/$defs/SchematicTextVariable"
77///      }
78///    },
79///    "type": {
80///      "type": "string",
81///      "const": "kicad_monkey.schematic_plot.request"
82///    },
83///    "version": {
84///      "type": "string",
85///      "const": "a0"
86///    },
87///    "worksheet_mode": {
88///      "$ref": "#/$defs/SchematicWorksheetMode"
89///    }
90///  },
91///  "additionalProperties": false
92///}
93/// ```
94/// </details>
95#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
96#[serde(deny_unknown_fields)]
97pub struct SchematicPlotRequestA0 {
98    pub default_line_width_nm: crate::SchematicDefaultLineWidthNm,
99    #[serde(
100        default,
101        deserialize_with = "crate::deserialize_present_nonnull",
102        skip_serializing_if = "::std::option::Option::is_none"
103    )]
104    pub document_id: ::std::option::Option<::std::string::String>,
105    pub sheet_count: ::std::num::NonZeroU32,
106    pub sheet_index: ::std::num::NonZeroU32,
107    pub sheet_name: ::std::string::String,
108    pub sheet_path: ::std::string::String,
109    #[serde(
110        default,
111        deserialize_with = "crate::deserialize_present_nonnull",
112        skip_serializing_if = "::std::option::Option::is_none"
113    )]
114    pub source_path: ::std::option::Option<::std::string::String>,
115    pub text_offset_ratio: crate::NonNegativeFiniteFloat,
116    #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
117    pub text_variables: ::std::vec::Vec<SchematicTextVariable>,
118    #[serde(rename = "type")]
119    pub type_: ::std::string::String,
120    pub version: ::std::string::String,
121    pub worksheet_mode: SchematicWorksheetMode,
122}
123///One exact-case project text variable supplied by the caller.
124///
125/// <details><summary>JSON schema</summary>
126///
127/// ```json
128///{
129///  "description": "One exact-case project text variable supplied by the caller.",
130///  "type": "object",
131///  "required": [
132///    "name",
133///    "value"
134///  ],
135///  "properties": {
136///    "name": {
137///      "type": "string"
138///    },
139///    "value": {
140///      "type": "string"
141///    }
142///  },
143///  "additionalProperties": false
144///}
145/// ```
146/// </details>
147#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
148#[serde(deny_unknown_fields)]
149pub struct SchematicTextVariable {
150    pub name: ::std::string::String,
151    pub value: ::std::string::String,
152}
153///Selection of the drawing-sheet byte sidecar supplied out of band.
154///
155/// <details><summary>JSON schema</summary>
156///
157/// ```json
158///{
159///  "description": "Selection of the drawing-sheet byte sidecar supplied out of band.",
160///  "type": "string",
161///  "enum": [
162///    "default",
163///    "provided"
164///  ]
165///}
166/// ```
167/// </details>
168#[derive(
169    ::serde::Deserialize,
170    ::serde::Serialize,
171    Clone,
172    Copy,
173    Debug,
174    Eq,
175    Hash,
176    Ord,
177    PartialEq,
178    PartialOrd,
179)]
180pub enum SchematicWorksheetMode {
181    #[serde(rename = "default")]
182    Default,
183    #[serde(rename = "provided")]
184    Provided,
185}
186impl ::std::fmt::Display for SchematicWorksheetMode {
187    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
188        match *self {
189            Self::Default => f.write_str("default"),
190            Self::Provided => f.write_str("provided"),
191        }
192    }
193}
194impl ::std::str::FromStr for SchematicWorksheetMode {
195    type Err = self::error::ConversionError;
196    fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
197        match value {
198            "default" => Ok(Self::Default),
199            "provided" => Ok(Self::Provided),
200            _ => Err("invalid value".into()),
201        }
202    }
203}
204impl ::std::convert::TryFrom<&str> for SchematicWorksheetMode {
205    type Error = self::error::ConversionError;
206    fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
207        value.parse()
208    }
209}
210impl ::std::convert::TryFrom<&::std::string::String> for SchematicWorksheetMode {
211    type Error = self::error::ConversionError;
212    fn try_from(
213        value: &::std::string::String,
214    ) -> ::std::result::Result<Self, self::error::ConversionError> {
215        value.parse()
216    }
217}
218impl ::std::convert::TryFrom<::std::string::String> for SchematicWorksheetMode {
219    type Error = self::error::ConversionError;
220    fn try_from(
221        value: ::std::string::String,
222    ) -> ::std::result::Result<Self, self::error::ConversionError> {
223        value.parse()
224    }
225}