1use log::kv::{Error, Key, Source, ToKey, ToValue, Value, Visitor};
2
3#[derive(Debug)]
7pub enum Http {
8 Request,
10 Response,
12}
13
14impl ToKey for Http {
15 fn to_key(&self) -> Key<'_> {
16 "http_mark".into()
17 }
18}
19
20impl ToValue for Http {
21 fn to_value(&self) -> Value<'_> {
22 match self {
23 Self::Request => "request".into(),
24 Self::Response => "response".into(),
25 }
26 }
27}
28
29impl Source for Http {
30 fn visit<'kvs>(&'kvs self, visitor: &mut dyn Visitor<'kvs>) -> Result<(), Error>
31 where
32 Self: Sized,
33 {
34 visitor.visit_pair(self.to_key(), self.to_value())?;
35 Ok(())
36 }
37
38 #[inline]
39 fn count(&self) -> usize {
40 1
41 }
42}