Skip to main content

sark_core/http/head/
visitor.rs

1use crate::error::Result;
2
3#[derive(Clone, Copy, Debug, PartialEq, Eq)]
4pub enum Known {
5    Host,
6    Expect,
7    Connection,
8    ContentLength,
9    TransferEncoding,
10    AcceptEncoding,
11}
12
13pub trait Visitor {
14    type Parsed;
15
16    const WANTS_KNOWN: bool = false;
17
18    fn start_line(&mut self, parsed: &Self::Parsed, raw: &[u8]) -> Result<()> {
19        let _ = (parsed, raw);
20        Ok(())
21    }
22    fn known(&mut self, key: Known, value: &[u8]) -> Result<()> {
23        let _ = (key, value);
24        Ok(())
25    }
26    fn unknown(&mut self, name: &[u8], value: &[u8]) -> Result<()> {
27        let _ = (name, value);
28        Ok(())
29    }
30}
31
32impl Visitor for () {
33    type Parsed = ();
34}