Quickly (~20ns) generate a date for an HTTP header, formatted to be fully compliant with RFCs 822/1123/2616. This is used in the faf web server
This crate is simple, you pass a buffer to the provided function. The function populates the buffer with the date
&str
or String
. See the examples belowThis is a heavily optimized, stripped, and otherwise modified version of pyfisch/httpdate
// Format: b"Thu, 01 Jan 1970 00:00:00 GMT" ``` let mut buf = fafhttpdate::getdatebuffnokey(); fafhttpdate::getdateno_key(&mut buf);
// Optional, convert to str let datestr = unsafe { std::str::fromutf8_unchecked(&buf[..]) }; ```
Format: b"Date: Thu, 01 Jan 1970 00:00:00 GMT" (notice the 'Date: ' at the first) ``` let mut buf = fafhttpdate::getdatebuffwithkey(); fafhttpdate::getdatewith_key(&mut buf);
// Optional, convert to str let datestr = unsafe { std::str::fromutf8_unchecked(&buf[..]) }; ```