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
use core::fmt::{self, Display, Formatter};
#[cfg(feature = "std")]
use std::error::Error;
#[derive(Debug, Clone)]
pub enum IPv6Error {
Invalid,
LocalMust,
LocalNotAllow,
PortMust,
PortNotAllow,
}
impl Display for IPv6Error {
#[inline]
fn fmt(&self, f: &mut Formatter) -> Result<(), fmt::Error> {
match self {
IPv6Error::Invalid => f.write_str("invalid domain or IPv6"),
IPv6Error::LocalMust => f.write_str("must be local"),
IPv6Error::LocalNotAllow => f.write_str("must not be local"),
IPv6Error::PortMust => f.write_str("port not found"),
IPv6Error::PortNotAllow => f.write_str("port not allowed"),
}
}
}
#[cfg(feature = "std")]
impl Error for IPv6Error {}