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

Method ascii

crates/vm/src/protocol/object.rs:375–382  ·  view source on GitHub ↗
(&self, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

373 }
374
375 pub fn ascii(&self, vm: &VirtualMachine) -> PyResult<PyRef<PyStr>> {
376 let repr = self.repr(vm)?;
377 if repr.as_wtf8().is_ascii() {
378 Ok(repr)
379 } else {
380 Ok(vm.ctx.new_str(to_ascii(repr.as_wtf8())))
381 }
382 }
383
384 pub fn str_utf8(&self, vm: &VirtualMachine) -> PyResult<PyRef<PyUtf8Str>> {
385 self.str(vm)?.try_into_utf8(vm)

Callers 1

asciiFunction · 0.80

Calls 5

to_asciiFunction · 0.85
reprMethod · 0.45
is_asciiMethod · 0.45
as_wtf8Method · 0.45
new_strMethod · 0.45

Tested by

no test coverage detected