use core::fmt::{self, Display, Formatter};
#[cfg(feature = "std")]
use std::error::Error;
#[derive(Debug, Clone)]
pub enum Ipv6Error {
Invalid,
LocalMust,
LocalDisallow,
PortMust,
PortDisallow,
}
impl Display for Ipv6Error {
#[inline]
fn fmt(&self, f: &mut Formatter) -> Result<(), fmt::Error> {
match self {
Self::Invalid => f.write_str("invalid IPv6"),
Self::LocalMust => f.write_str("must be local"),
Self::LocalDisallow => f.write_str("must not be local"),
Self::PortMust => f.write_str("port not found"),
Self::PortDisallow => f.write_str("port not allowed"),
}
}
}
#[cfg(feature = "std")]
impl Error for Ipv6Error {}