Skip to main content

CheckValue

Trait CheckValue 

Source
pub trait CheckValue<T> {
    // Required method
    fn check(&self, value: &T) -> Result<()>;
}
Expand description

Trait for validating cache values.

This trait can be implemented to provide custom validation logic for cached values. If validation fails, the cached value will be considered invalid and a fresh value will be retrieved.

Required Methods§

Source

fn check(&self, value: &T) -> Result<()>

Validate the given value.

Returns Ok(()) if the value is valid, or Err(CachifiedError) if invalid.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§