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

Method as_buffer

crates/stdlib/src/mmap.rs:791–800  ·  view source on GitHub ↗
(zelf: &Py<Self>, _vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

789
790 impl AsBuffer for PyMmap {
791 fn as_buffer(zelf: &Py<Self>, _vm: &VirtualMachine) -> PyResult<PyBuffer> {
792 let readonly = matches!(zelf.access, AccessMode::Read);
793 let buf = PyBuffer::new(
794 zelf.to_owned().into(),
795 BufferDescriptor::simple(zelf.__len__(), readonly),
796 &BUFFER_METHODS,
797 );
798
799 Ok(buf)
800 }
801 }
802
803 impl AsMapping for PyMmap {

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