use core::fmt::{self, Display, Formatter};
use crate::AddressError;
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[repr(u16)]
#[non_exhaustive]
pub enum AddressInterface {
BasicWallet = Self::BASIC_WALLET,
}
impl AddressInterface {
const BASIC_WALLET: u16 = 0;
}
impl TryFrom<u16> for AddressInterface {
type Error = AddressError;
fn try_from(value: u16) -> Result<Self, Self::Error> {
match value {
Self::BASIC_WALLET => Ok(Self::BasicWallet),
other => Err(AddressError::UnknownAddressInterface(other)),
}
}
}
impl Display for AddressInterface {
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
match self {
Self::BasicWallet => write!(f, "BasicWallet"),
}
}
}