(&self)
| 433 | |
| 434 | impl PyStructSequenceMeta { |
| 435 | pub fn class_name(&self) -> Result<Option<String>> { |
| 436 | const KEY: &str = "name"; |
| 437 | let inner = self.inner(); |
| 438 | if let Some((_, meta)) = inner.meta_map.get(KEY) { |
| 439 | if let Meta::NameValue(syn::MetaNameValue { |
| 440 | value: |
| 441 | syn::Expr::Lit(syn::ExprLit { |
| 442 | lit: syn::Lit::Str(lit), |
| 443 | .. |
| 444 | }), |
| 445 | .. |
| 446 | }) = meta |
| 447 | { |
| 448 | return Ok(Some(lit.value())); |
| 449 | } |
| 450 | bail_span!( |
| 451 | inner.meta_ident, |
| 452 | "#[pystruct_sequence({KEY}=value)] expects a string value" |
| 453 | ) |
| 454 | } else { |
| 455 | Ok(None) |
| 456 | } |
| 457 | } |
| 458 | |
| 459 | pub fn module(&self) -> Result<Option<String>> { |
| 460 | const KEY: &str = "module"; |
no test coverage detected