#[repr(u8)]
#[derive(Debug, Copy, Clone, Ord, PartialOrd, Eq, PartialEq, Hash)]
#[derive(Serialize, Deserialize)]
pub enum InternetProtocolVersion6MulticastAddressScope
{
InterfaceLocal = 0x1,
#[allow(missing_docs)]
LinkLocal = 0x2,
RealmLocal = 0x3,
AdminLocal = 0x4,
#[allow(missing_docs)]
SiteLocal = 0x5,
#[allow(missing_docs)]
OrganisationLocal = 0x8,
Global = 0xE,
}
impl TryFrom<u8> for InternetProtocolVersion6MulticastAddressScope
{
type Error = ();
#[inline(always)]
fn try_from(value: u8) -> Result<Self, Self::Error>
{
use self::InternetProtocolVersion6MulticastAddressScope::*;
let this = match value
{
0x1 => InterfaceLocal,
0x2 => LinkLocal,
0x3 => RealmLocal,
0x4 => AdminLocal,
0x5 => SiteLocal,
0x8 => OrganisationLocal,
0xE => Global,
_ => return Err(()),
};
Ok(this)
}
}
impl Display for InternetProtocolVersion6MulticastAddressScope
{
fn fmt(&self, f: &mut Formatter) -> fmt::Result
{
use self::InternetProtocolVersion6MulticastAddressScope::*;
let string = match *self
{
InterfaceLocal => "interface local",
LinkLocal => "link local",
RealmLocal => "realm local",
AdminLocal => "admin local",
SiteLocal => "site local",
OrganisationLocal => "organisation local",
Global => "global",
};
write!(f, "{}", string)
}
}
impl Default for InternetProtocolVersion6MulticastAddressScope
{
#[inline(always)]
fn default() -> Self
{
InternetProtocolVersion6MulticastAddressScope::InterfaceLocal
}
}
impl InternetProtocolVersion6MulticastAddressScope
{
#[inline(always)]
pub fn is_interface_local_also_known_as_loopback(self) -> bool
{
self == InternetProtocolVersion6MulticastAddressScope::InterfaceLocal
}
}