MCPcopy Create free account
hub / github.com/dgrunwald/rust-cpython / get

Method get

src/buffer.rs:165–175  ·  view source on GitHub ↗

Get the underlying buffer from the specified python object.

(py: Python, obj: &PyObject)

Source from the content-addressed store, hash-verified

163impl PyBuffer {
164 /// Get the underlying buffer from the specified python object.
165 pub fn get(py: Python, obj: &PyObject) -> PyResult<PyBuffer> {
166 unsafe {
167 let mut buf = Box::new(mem::zeroed::<ffi::Py_buffer>());
168 err::error_on_minusone(
169 py,
170 ffi::PyObject_GetBuffer(obj.as_ptr(), &mut *buf, ffi::PyBUF_FULL_RO),
171 )?;
172 validate(&buf);
173 Ok(PyBuffer(buf))
174 }
175 }
176
177 /// Gets the pointer to the start of the buffer memory.
178 ///

Callers 10

get_interpreter_versionFunction · 0.45
version_from_envFunction · 0.45
mainFunction · 0.45
get_interpreter_versionFunction · 0.45
version_from_envFunction · 0.45
mainFunction · 0.45
as_ptrMethod · 0.45
check_symbols.pyFile · 0.45
empty_class_in_moduleFunction · 0.45
helloFunction · 0.45

Calls 4

error_on_minusoneFunction · 0.85
validateFunction · 0.85
PyBufferClass · 0.85
as_ptrMethod · 0.45

Tested by 1

empty_class_in_moduleFunction · 0.36