diff options
Diffstat (limited to 'src/context.rs')
| -rw-r--r-- | src/context.rs | 48 | 
1 files changed, 48 insertions, 0 deletions
| diff --git a/src/context.rs b/src/context.rs new file mode 100644 index 0000000..ef8c7cb --- /dev/null +++ b/src/context.rs @@ -0,0 +1,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") +            }, +        } +    } +} | 
