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

Method as_buffer

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

Source from the content-addressed store, hash-verified

732
733impl AsBuffer for PyByteArray {
734 fn as_buffer(zelf: &Py<Self>, _vm: &VirtualMachine) -> PyResult<PyBuffer> {
735 Ok(PyBuffer::new(
736 zelf.to_owned().into(),
737 BufferDescriptor::simple(zelf.__len__(), false),
738 &BUFFER_METHODS,
739 ))
740 }
741}
742
743impl BufferResizeGuard for PyByteArray {

Callers

nothing calls this directly

Calls 4

newFunction · 0.85
simpleFunction · 0.85
to_ownedMethod · 0.45
__len__Method · 0.45

Tested by

no test coverage detected