Skip to main content

CacheKeyHasher

Struct CacheKeyHasher 

Source
pub struct CacheKeyHasher { /* private fields */ }
Expand description

Incremental hasher used to build structured cache keys.

Implementations§

Source§

impl CacheKeyHasher

Source

pub fn new() -> Self

Create an empty cache-key hasher.

Source

pub fn write_tag(&mut self, tag: &[u8])

Write a caller-defined domain tag into the key.

Source

pub fn write_bool(&mut self, value: bool)

Write a boolean value into the key.

Source

pub fn write_u8(&mut self, value: u8)

Write an unsigned 8-bit integer into the key.

Source

pub fn write_u32(&mut self, value: u32)

Write an unsigned 32-bit integer into the key.

Source

pub fn write_u64(&mut self, value: u64)

Write an unsigned 64-bit integer into the key.

Source

pub fn write_u128(&mut self, value: u128)

Write an unsigned 128-bit integer into the key.

Source

pub fn write_usize(&mut self, value: usize)

Write a usize value into the key using a platform-independent encoding.

Source

pub fn write_str(&mut self, value: &str)

Write a UTF-8 string into the key.

Source

pub fn write_bytes(&mut self, bytes: &[u8])

Write a byte slice into the key with a length prefix.

Source

pub fn finish_hex(self) -> String

Finish the hasher and return a lowercase hex digest.

Trait Implementations§

Source§

impl Default for CacheKeyHasher

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.