INNER CODE UNIT · Rust

__hash__

autopilot-rs/autopy · src/bitmap.rs:34

    fn __hash__(&self) -> PyResult<isize> {
        let mut s = DefaultHasher::new();
        self.bitmap.hash(&mut s);
        Ok(s.finish() as isize)
    }

    // From
    // https://github.com/PyO3/pyo3/blob/97189a1/tests/test_buffer_protocol.rs#L17
    unsafe fn __getbuffer__(&self, view: *mut pyo3::ffi::Py_buffer, flags: libc::c_int) -> PyResult<()> {
        use pyo3::exceptions::PyBufferError;
        use pyo3::*;
        use std::ffi::CStr;
        use std::ptr;

        if view.is_null() {
            return Err(PyBufferError::new_err("View is null"));
        }

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…