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

Method as_buffer

crates/vm/src/builtins/bytes.rs:615–622  ·  view source on GitHub ↗
(zelf: &Py<Self>, _vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

613
614impl AsBuffer for PyBytes {
615 fn as_buffer(zelf: &Py<Self>, _vm: &VirtualMachine) -> PyResult<PyBuffer> {
616 let buf = PyBuffer::new(
617 zelf.to_owned().into(),
618 BufferDescriptor::simple(zelf.len(), true),
619 &BUFFER_METHODS,
620 );
621 Ok(buf)
622 }
623}
624
625impl AsMapping for PyBytes {

Callers

nothing calls this directly

Calls 4

newFunction · 0.85
simpleFunction · 0.85
to_ownedMethod · 0.45
lenMethod · 0.45

Tested by

no test coverage detected