artichoke_backend/
hash.rs

1use std::collections::hash_map::RandomState;
2
3use crate::Artichoke;
4use crate::core::Hash;
5use crate::error::Error;
6use crate::ffi::InterpreterExtractError;
7
8impl Hash for Artichoke {
9    type Error = Error;
10    type GlobalBuildHasher = RandomState;
11
12    fn global_build_hasher(&mut self) -> Result<&Self::GlobalBuildHasher, Self::Error> {
13        let state = self.state.as_deref_mut().ok_or_else(InterpreterExtractError::new)?;
14        Ok(&state.hash_builder)
15    }
16}