Skip to main content

encode

Function encode 

Source
pub fn encode(date: &HttpDate) -> String
Expand description

Formats an HTTP date as a string in its original textual format.

The output is guaranteed to parse back with decode to the same value. HttpDate values are always well-formed — constructed via HttpDate::imf_fixdate, HttpDate::rfc850, or HttpDate::asctime, or parsed with decode — so formatting cannot fail.

§Examples

use http_date::{decode, encode};

let date = decode("Sun, 06 Nov 1994 08:49:37 GMT").unwrap();
assert_eq!(encode(&date), "Sun, 06 Nov 1994 08:49:37 GMT");