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

Method hash

src/objectprotocol.rs:256–263  ·  view source on GitHub ↗
(&self, py: Python)

Source from the content-addressed store, hash-verified

254 /// This is equivalent to the Python expression: 'hash(self)'
255 #[inline]
256 fn hash(&self, py: Python) -> PyResult<crate::Py_hash_t> {
257 let v = unsafe { ffi::PyObject_Hash(self.as_ptr()) };
258 if v == -1 {
259 Err(PyErr::fetch(py))
260 } else {
261 Ok(v)
262 }
263 }
264
265 /// Returns whether the object is considered to be true.
266 /// This is equivalent to the Python expression: 'not not self'

Callers

nothing calls this directly

Implementers 1

objectprotocol.rssrc/objectprotocol.rs

Calls 1

as_ptrMethod · 0.45

Tested by

no test coverage detected