Debian Codegraph @

src/memoryobject.rs

raw symbols SCIP
1 use crate::object::*;
2 use crate::pyport::Py_ssize_t;
3 use std::ffi::{c_char, c_int};
4 use std::ptr::addr_of_mut;
5
6 // skipped _PyManagedBuffer_Type
7
8 #[cfg_attr(windows, link(name = "pythonXY"))]
9 extern "C" {
10 #[cfg_attr(PyPy, link_name = "PyPyMemoryView_Type")]
11 pub static mut PyMemoryView_Type: PyTypeObject;
12 }
13
14 #[inline]
15 pub unsafe fn PyMemoryView_Check(op: *mut PyObject) -> c_int {
16 (Py_TYPE(op) == addr_of_mut!(PyMemoryView_Type)) as c_int
17 }
18
19 // skipped non-limited PyMemoryView_GET_BUFFER
20 // skipped non-limited PyMemoryView_GET_BASE
21
22 extern "C" {
23 #[cfg_attr(PyPy, link_name = "PyPyMemoryView_FromObject")]
24 pub fn PyMemoryView_FromObject(base: *mut PyObject) -> *mut PyObject;
25 #[cfg_attr(PyPy, link_name = "PyPyMemoryView_FromMemory")]
26 pub fn PyMemoryView_FromMemory(
27 mem: *mut c_char,
28 size: Py_ssize_t,
29 flags: c_int,
30 ) -> *mut PyObject;
31 #[cfg(any(Py_3_11, not(Py_LIMITED_API)))]
32 #[cfg_attr(PyPy, link_name = "PyPyMemoryView_FromBuffer")]
33 pub fn PyMemoryView_FromBuffer(view: *const crate::Py_buffer) -> *mut PyObject;
34 #[cfg_attr(PyPy, link_name = "PyPyMemoryView_GetContiguous")]
35 pub fn PyMemoryView_GetContiguous(
36 base: *mut PyObject,
37 buffertype: c_int,
38 order: c_char,
39 ) -> *mut PyObject;
40 }
41
42 // skipped remainder of file with comment:
43 /* The structs are declared here so that macros can work, but they shouldn't
44 be considered public. Don't access their fields directly, use the macros
45 and functions instead! */