Enum wiggle_generate::config::ErrorConfField
source · pub enum ErrorConfField {
Trappable(TrappableErrorConfField),
User(UserErrorConfField),
}
Variants§
Trappable(TrappableErrorConfField)
User(UserErrorConfField)
Implementations§
source§impl ErrorConfField
impl ErrorConfField
sourcepub fn abi_error(&self) -> &Ident
pub fn abi_error(&self) -> &Ident
Examples found in repository?
src/config.rs (line 278)
271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292
fn parse(input: ParseStream) -> Result<Self> {
let content;
let _ = braced!(content in input);
let items: Punctuated<ErrorConfField, Token![,]> =
content.parse_terminated(Parse::parse)?;
let mut m = HashMap::new();
for i in items {
match m.insert(i.abi_error().clone(), i.clone()) {
None => {}
Some(prev_def) => {
return Err(Error::new(
*i.err_loc(),
format!(
"duplicate definition of rich error type for {:?}: previously defined at {:?}",
i.abi_error(), prev_def.err_loc(),
),
))
}
}
}
Ok(ErrorConf(m))
}
sourcepub fn err_loc(&self) -> &Span
pub fn err_loc(&self) -> &Span
Examples found in repository?
src/config.rs (line 282)
271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292
fn parse(input: ParseStream) -> Result<Self> {
let content;
let _ = braced!(content in input);
let items: Punctuated<ErrorConfField, Token![,]> =
content.parse_terminated(Parse::parse)?;
let mut m = HashMap::new();
for i in items {
match m.insert(i.abi_error().clone(), i.clone()) {
None => {}
Some(prev_def) => {
return Err(Error::new(
*i.err_loc(),
format!(
"duplicate definition of rich error type for {:?}: previously defined at {:?}",
i.abi_error(), prev_def.err_loc(),
),
))
}
}
}
Ok(ErrorConf(m))
}
Trait Implementations§
source§impl Clone for ErrorConfField
impl Clone for ErrorConfField
source§fn clone(&self) -> ErrorConfField
fn clone(&self) -> ErrorConfField
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read more