Skip to main content

hash_request

Function hash_request 

Source
pub fn hash_request<T: Serialize>(value: &T) -> u64
Available on crate features async and pricing only.
Expand description

Hash a value’s serde-JSON serialization to a stable u64. Suitable as a cache key for CountTokensCache. Returns the empty-string hash on serialization failure (effectively groups malformed inputs together; shouldn’t happen for crate-owned types).