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

Method from

crates/jit/tests/common.rs:58–74  ·  view source on GitHub ↗
(value: ConstantData)

Source from the content-addressed store, hash-verified

56
57impl From<ConstantData> for StackValue {
58 fn from(value: ConstantData) -> Self {
59 match value {
60 ConstantData::Str { value } => {
61 StackValue::String(value.into_string().expect("surrogate in test code"))
62 }
63 ConstantData::None => StackValue::None,
64 ConstantData::Code { code } => StackValue::Code(code),
65 ConstantData::Slice { elements } => {
66 let [start, stop, step] = *elements;
67 StackValue::Slice(Box::new([start.into(), stop.into(), step.into()]))
68 }
69 ConstantData::Frozenset { elements } => {
70 StackValue::Frozenset(elements.into_iter().map(Into::into).collect())
71 }
72 c => unimplemented!("constant {:?} isn't yet supported in py_function!", c),
73 }
74 }
75}
76
77/// Extract annotations from an annotate function's bytecode.

Callers

nothing calls this directly

Calls 6

newFunction · 0.85
into_stringMethod · 0.80
collectMethod · 0.80
StringClass · 0.50
mapMethod · 0.45
into_iterMethod · 0.45

Tested by

no test coverage detected