Debian Codegraph @

third_party/rust/headers/src/disabled/last_event_id.rs

raw
1 use std::fmt;
2
3 use util::HeaderValueString;
4
5 /// `Last-Event-ID` header, defined in
6 /// [RFC3864](https://html.spec.whatwg.org/multipage/references.html#refsRFC3864)
7 ///
8 /// The `Last-Event-ID` header contains information about
9 /// the last event in an http interaction so that it's easier to
10 /// track of event state. This is helpful when working
11 /// with [Server-Sent-Events](http://www.html5rocks.com/en/tutorials/eventsource/basics/). If the connection were to be dropped, for example, it'd
12 /// be useful to let the server know what the last event you
13 /// received was.
14 ///
15 /// The spec is a String with the id of the last event, it can be
16 /// an empty string which acts a sort of "reset".
17 // NOTE: This module is disabled since there is no const LAST_EVENT_ID to be
18 // used for the `impl Header`. It should be possible to enable this module
19 // when `HeaderName::from_static` can become a `const fn`.
20 #[derive(Clone, Debug, PartialEq, Header)]
21 pub struct LastEventId(HeaderValueString);
22
23
24 impl fmt::Display for LastEventId {
25 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
26 fmt::Display::fmt(&self.0, f)
27 }
28 }
29
30 #[cfg(test)]
31 mod tests {
32
33 /*
34 // Initial state
35 test_header!(test1, vec![b""]);
36 // Own testcase
37 test_header!(test2, vec![b"1"], Some(LastEventId("1".to_owned())));
38 */
39 }
40