MCPcopy Index your code
hub / github.com/RustPython/RustPython / module

Method module

crates/derive-impl/src/pystructseq.rs:459–481  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

457 }
458
459 pub fn module(&self) -> Result<Option<String>> {
460 const KEY: &str = "module";
461 let inner = self.inner();
462 if let Some((_, meta)) = inner.meta_map.get(KEY) {
463 if let Meta::NameValue(syn::MetaNameValue {
464 value:
465 syn::Expr::Lit(syn::ExprLit {
466 lit: syn::Lit::Str(lit),
467 ..
468 }),
469 ..
470 }) = meta
471 {
472 return Ok(Some(lit.value()));
473 }
474 bail_span!(
475 inner.meta_ident,
476 "#[pystruct_sequence({KEY}=value)] expects a string value"
477 )
478 } else {
479 Ok(None)
480 }
481 }
482
483 fn data_type(&self) -> Result<Ident> {
484 const KEY: &str = "data";

Callers 1

impl_pystruct_sequenceFunction · 0.45

Calls 4

SomeClass · 0.50
innerMethod · 0.45
getMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected