doless_core 0.4.0

A Rust macro to simplify struct mapping and function utilities.
Documentation
1
2
3
4
5
6
7
8
9
10
11
use serde::{de::DeserializeOwned, Serialize};

pub trait Cache {
    fn get<T: DeserializeOwned + Clone>(&self, key: &str) -> Option<T>;
    fn set<T: Serialize>(&self, key: &str, value: &T);

    fn set_with<T: Serialize>(&self, key: &str, value: &T, extra: u32) {
        let _ = extra; // ignored by default
        self.set(key, value);
    }
}