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