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

Method repr_wtf8

crates/vm/src/builtins/interpolation.rs:204–224  ·  view source on GitHub ↗
(zelf: &Py<Self>, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

202impl Representable for PyInterpolation {
203 #[inline]
204 fn repr_wtf8(zelf: &Py<Self>, vm: &VirtualMachine) -> PyResult<Wtf8Buf> {
205 let value_repr = zelf.value.repr(vm)?;
206 let expr_repr = zelf.expression.repr(vm)?;
207 let spec_repr = zelf.format_spec.repr(vm)?;
208
209 let mut result = Wtf8Buf::from("Interpolation(");
210 result.push_wtf8(value_repr.as_wtf8());
211 result.push_str(", ");
212 result.push_str(&expr_repr);
213 result.push_str(", ");
214 if vm.is_none(&zelf.conversion) {
215 result.push_str("None");
216 } else {
217 result.push_wtf8(zelf.conversion.repr(vm)?.as_wtf8());
218 }
219 result.push_str(", ");
220 result.push_str(&spec_repr);
221 result.push_char(')');
222
223 Ok(result)
224 }
225}
226
227pub fn init(context: &'static Context) {

Callers

nothing calls this directly

Calls 6

push_wtf8Method · 0.80
reprMethod · 0.45
as_wtf8Method · 0.45
push_strMethod · 0.45
is_noneMethod · 0.45
push_charMethod · 0.45

Tested by

no test coverage detected