MCPcopy Create free account
hub / github.com/PyO3/pyo3 / __getbuffer__

Method __getbuffer__

tests/test_buffer_protocol.rs:27–33  ·  view source on GitHub ↗
(
        slf: Bound<'_, Self>,
        view: *mut ffi::Py_buffer,
        flags: c_int,
    )

Source from the content-addressed store, hash-verified

25#[pymethods]
26impl TestBufferClass {
27 unsafe fn __getbuffer__(
28 slf: Bound<'_, Self>,
29 view: *mut ffi::Py_buffer,
30 flags: c_int,
31 ) -> PyResult<()> {
32 unsafe { fill_view_from_readonly_data(view, flags, &slf.borrow().vec, slf.into_any()) }
33 }
34
35 unsafe fn __releasebuffer__(&self, view: *mut ffi::Py_buffer) {
36 // Release memory held by the format string

Callers

nothing calls this directly

Calls 3

into_anyMethod · 0.80
borrowMethod · 0.45

Tested by

no test coverage detected