-
Notifications
You must be signed in to change notification settings - Fork 198
/
_pyo3_dict.rs
39 lines (32 loc) · 882 Bytes
/
_pyo3_dict.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// TODO: remove this file once a new pyo3 version is released
// with https://github.com/PyO3/pyo3/pull/2358
use pyo3::{ffi, pyobject_native_type_core, PyAny};
/// Represents a Python `dict_keys`.
#[cfg(not(PyPy))]
#[repr(transparent)]
pub struct PyDictKeys(PyAny);
#[cfg(not(PyPy))]
pyobject_native_type_core!(
PyDictKeys,
ffi::PyDictKeys_Type,
#checkfunction=ffi::PyDictKeys_Check
);
/// Represents a Python `dict_values`.
#[cfg(not(PyPy))]
#[repr(transparent)]
pub struct PyDictValues(PyAny);
#[cfg(not(PyPy))]
pyobject_native_type_core!(
PyDictValues,
ffi::PyDictValues_Type,
#checkfunction=ffi::PyDictValues_Check
);
/// Represents a Python `dict_items`.
#[cfg(not(PyPy))]
pub struct PyDictItems(PyAny, PyAny);
#[cfg(not(PyPy))]
pyobject_native_type_core!(
PyDictItems,
ffi::PyDictItems_Type,
#checkfunction=ffi::PyDictItems_Check
);