pyo3_ffi/cpython/
pyhash.rs1#[cfg(Py_3_13)]
2use crate::PyObject;
3use crate::{Py_hash_t, Py_ssize_t};
4use std::os::raw::{c_char, c_int, c_void};
5
6#[repr(C)]
7#[derive(Copy, Clone)]
8pub struct PyHash_FuncDef {
9 pub hash: Option<extern "C" fn(arg1: *const c_void, arg2: Py_ssize_t) -> Py_hash_t>,
10 pub name: *const c_char,
11 pub hash_bits: c_int,
12 pub seed_bits: c_int,
13}
14
15impl Default for PyHash_FuncDef {
16 #[inline]
17 fn default() -> Self {
18 unsafe { std::mem::zeroed() }
19 }
20}
21
22extern "C" {
23 pub fn PyHash_GetFuncDef() -> *mut PyHash_FuncDef;
24 #[cfg(Py_3_13)]
25 pub fn Py_HashPointer(ptr: *const c_void) -> Py_hash_t;
26 #[cfg(Py_3_13)]
27 pub fn PyObject_GenericHash(obj: *mut PyObject) -> Py_hash_t;
28 #[cfg(Py_3_14)]
29 pub fn Py_HashBuffer(ptr: *const c_void, len: Py_ssize_t) -> Py_hash_t;
30}