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

Method class_name

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

Source from the content-addressed store, hash-verified

433
434impl 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";

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