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

Function ascii_encode

crates/vm/src/stdlib/_codecs.rs:231–236  ·  view source on GitHub ↗
(args: EncodeArgs, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

229
230 #[pyfunction]
231 fn ascii_encode(args: EncodeArgs, vm: &VirtualMachine) -> EncodeResult {
232 if args.s.isascii() {
233 return Ok((args.s.as_bytes().to_vec(), args.s.byte_len()));
234 }
235 do_codec!(ascii::encode, args, vm)
236 }
237
238 #[pyfunction]
239 fn ascii_decode(args: DecodeArgsNoFinal, vm: &VirtualMachine) -> DecodeResult {

Callers

nothing calls this directly

Calls 4

to_vecMethod · 0.80
isasciiMethod · 0.45
as_bytesMethod · 0.45
byte_lenMethod · 0.45

Tested by

no test coverage detected