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

Method try_from

crates/derive-impl/src/from_args.rs:21–29  ·  view source on GitHub ↗
(ident: &Ident)

Source from the content-addressed store, hash-verified

19 type Error = ();
20
21 fn try_from(ident: &Ident) -> core::result::Result<Self, Self::Error> {
22 Ok(match ident.to_string().as_str() {
23 "positional" => Self::PositionalOnly,
24 "any" => Self::PositionalOrKeyword,
25 "named" => Self::KeywordOnly,
26 "flatten" => Self::Flatten,
27 _ => return Err(()),
28 })
29 }
30}
31
32// None == quote!(Default::default())

Callers

nothing calls this directly

Calls 6

to_stringMethod · 0.80
ErrClass · 0.50
as_strMethod · 0.45
iterMethod · 0.45
lenMethod · 0.45
popMethod · 0.45

Tested by

no test coverage detected