kicad_monkey_contracts/generated/
symbol_library_edit_result.rs1pub mod error {
3 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#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
62#[serde(deny_unknown_fields)]
63pub struct Diagnostic {
64 pub code: ::std::string::String,
65 pub message: ::std::string::String,
66 pub phase: DiagnosticPhase,
67 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
68 pub position: ::std::option::Option<SourcePosition>,
69 #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
70 pub token: ::std::option::Option<::std::string::String>,
71}
72#[derive(
88 ::serde::Deserialize,
89 ::serde::Serialize,
90 Clone,
91 Copy,
92 Debug,
93 Eq,
94 Hash,
95 Ord,
96 PartialEq,
97 PartialOrd,
98)]
99pub enum DiagnosticPhase {
100 #[serde(rename = "lex")]
101 Lex,
102 #[serde(rename = "tree")]
103 Tree,
104 #[serde(rename = "build")]
105 Build,
106}
107impl ::std::fmt::Display for DiagnosticPhase {
108 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
109 match *self {
110 Self::Lex => f.write_str("lex"),
111 Self::Tree => f.write_str("tree"),
112 Self::Build => f.write_str("build"),
113 }
114 }
115}
116impl ::std::str::FromStr for DiagnosticPhase {
117 type Err = self::error::ConversionError;
118 fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
119 match value {
120 "lex" => Ok(Self::Lex),
121 "tree" => Ok(Self::Tree),
122 "build" => Ok(Self::Build),
123 _ => Err("invalid value".into()),
124 }
125 }
126}
127impl ::std::convert::TryFrom<&str> for DiagnosticPhase {
128 type Error = self::error::ConversionError;
129 fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
130 value.parse()
131 }
132}
133impl ::std::convert::TryFrom<&::std::string::String> for DiagnosticPhase {
134 type Error = self::error::ConversionError;
135 fn try_from(
136 value: &::std::string::String,
137 ) -> ::std::result::Result<Self, self::error::ConversionError> {
138 value.parse()
139 }
140}
141impl ::std::convert::TryFrom<::std::string::String> for DiagnosticPhase {
142 type Error = self::error::ConversionError;
143 fn try_from(
144 value: ::std::string::String,
145 ) -> ::std::result::Result<Self, self::error::ConversionError> {
146 value.parse()
147 }
148}
149#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
178#[serde(deny_unknown_fields)]
179pub struct SourcePosition {
180 pub column: ::std::string::String,
181 pub line: ::std::string::String,
182 pub offset: ::std::string::String,
183}
184#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
228#[serde(deny_unknown_fields)]
229pub struct SymbolLibraryEditResultA0 {
230 pub changed: bool,
231 pub diagnostics: ::std::vec::Vec<Diagnostic>,
232 pub output_bytes: ::std::string::String,
233 #[serde(rename = "type")]
234 pub type_: ::std::string::String,
235 pub version: ::std::string::String,
236}