pub struct Tag(pub u64);
Expand description
Facilitates caching of derived data.
Every time you look up a cert in the directory, the operation also
returns a tag. This tag, which can be converted to a u64
, is an
opaque identifier that changes whenever the cert in the directory
changes.
To use it, store the tag with your cached data, and every time you re-do the lookup, compare the returned tag with the stored tag to see if your cached data is still up-to-date.
§Examples
This demonstrates how to use the tag to prevent useless recomputations.
let fp = "eb85bb5fa33a75e15e944e63f231550c4f47e38e";
let (tag, cert) = certd.get(fp)?.expect("cert to exist");
// ...
if let Some((new_cert, new_tag)) = certd.get_if_changed(tag, fp)? {
// cert changed...
} else {
// cert didn't change...
}
Tuple Fields§
§0: u64
Trait Implementations§
impl Copy for Tag
impl Eq for Tag
impl StructuralPartialEq for Tag
Auto Trait Implementations§
impl Freeze for Tag
impl RefUnwindSafe for Tag
impl Send for Tag
impl Sync for Tag
impl Unpin for Tag
impl UnwindSafe for Tag
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more