pub struct DateCache { /* private fields */ }Expand description
A Date value reformatted at most once per second.
A server writes date on every response; formatting it once per second
instead of once per response saves the calendar arithmetic on all but the
first response of each second. Keep one per thread or per connection
driver: it is plain data, not shared state.
§Examples
use http_net::DateCache;
let mut cache = DateCache::new();
assert_eq!(cache.update(784_111_777).as_str(), "Sun, 06 Nov 1994 08:49:37 GMT");
// Same second: the stored value, no formatting.
assert_eq!(cache.update(784_111_777).as_str(), "Sun, 06 Nov 1994 08:49:37 GMT");
assert_eq!(cache.update(784_111_778).as_str(), "Sun, 06 Nov 1994 08:49:38 GMT");Implementations§
Source§impl DateCache
impl DateCache
Trait Implementations§
impl Copy for DateCache
impl Eq for DateCache
impl StructuralPartialEq for DateCache
Auto Trait Implementations§
impl Freeze for DateCache
impl RefUnwindSafe for DateCache
impl Send for DateCache
impl Sync for DateCache
impl Unpin for DateCache
impl UnsafeUnpin for DateCache
impl UnwindSafe for DateCache
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