Trait xitca_http::date::DateTime

source ·
pub trait DateTime {
    const DATE_VALUE_LENGTH: usize;

    // Required methods
    fn with_date<F, O>(&self, f: F) -> O
       where F: FnOnce(&[u8]) -> O;
    fn now(&self) -> Instant;
}
Expand description

Trait for getting current date/time.

This is usually used by a low resolution of timer to reduce frequent syscall to OS.

Required Associated Constants§

source

const DATE_VALUE_LENGTH: usize

The size hint of slice by Self::date method.

Required Methods§

source

fn with_date<F, O>(&self, f: F) -> O
where F: FnOnce(&[u8]) -> O,

closure would receive byte slice representation of HttpDate.

source

fn now(&self) -> Instant

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl DateTime for RefCell<DateTimeState>

source§

const DATE_VALUE_LENGTH: usize = 29usize

source§

fn with_date<F, O>(&self, f: F) -> O
where F: FnOnce(&[u8]) -> O,

source§

fn now(&self) -> Instant

Implementors§