aboutsummaryrefslogtreecommitdiff
path: root/src/context.rs
blob: ef8c7cbb01f55f55fceb3fd593a49d01753b2415 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#![warn(clippy::pedantic)]

#[derive(Debug, Clone, Copy, PartialEq)]
pub enum Context {
    Fragment,
    Host,
    Ipv4Address,
    Ipv6Address,
    IpvFuture,
    Path,
    Query,
    Scheme,
    Userinfo,
}

impl std::fmt::Display for Context {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        match self {
            Context::Fragment => {
                write!(f, "fragment")
            },
            Context::Host => {
                write!(f, "host")
            },
            Context::Ipv4Address => {
                write!(f, "IPv4 address")
            },
            Context::Ipv6Address => {
                write!(f, "IPv6 address")
            },
            Context::IpvFuture => {
                write!(f, "IPvFuture")
            },
            Context::Path => {
                write!(f, "path")
            },
            Context::Query => {
                write!(f, "query")
            },
            Context::Scheme => {
                write!(f, "scheme")
            },
            Context::Userinfo => {
                write!(f, "user info")
            },
        }
    }
}