MCPcopy Create free account
hub / github.com/0x676e67/wreq-python / fill_buffer_info

Function fill_buffer_info

src/buffer.rs:83–104  ·  view source on GitHub ↗

A helper function to fill buffer info

(
    bytes: &[u8],
    obj_ptr: *mut ffi::PyObject,
    view: *mut ffi::Py_buffer,
    flags: c_int,
    py: Python,
)

Source from the content-addressed store, hash-verified

81
82/// A helper function to fill buffer info
83unsafe fn fill_buffer_info(
84 bytes: &[u8],
85 obj_ptr: *mut ffi::PyObject,
86 view: *mut ffi::Py_buffer,
87 flags: c_int,
88 py: Python,
89) -> PyResult<()> {
90 let ret = unsafe {
91 ffi::PyBuffer_FillInfo(
92 view,
93 obj_ptr as *mut _,
94 bytes.as_ptr() as *mut _,
95 bytes.len() as _,
96 1,
97 flags,
98 )
99 };
100 if ret == -1 {
101 return Err(PyErr::fetch(py));
102 }
103 Ok(())
104}

Callers

nothing calls this directly

Calls 1

lenMethod · 0.80

Tested by

no test coverage detected