miden_objects/address/
type.rs1use crate::AddressError;
2use crate::errors::Bech32Error;
3
4#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
10#[repr(u8)]
11pub enum AddressType {
12 AccountId = Self::ACCOUNT_ID,
13}
14
15impl AddressType {
16 const ACCOUNT_ID: u8 = 0;
18}
19
20impl TryFrom<u8> for AddressType {
21 type Error = AddressError;
22
23 fn try_from(byte: u8) -> Result<Self, Self::Error> {
25 match byte {
26 Self::ACCOUNT_ID => Ok(Self::AccountId),
27 other => Err(AddressError::Bech32DecodeError(Bech32Error::UnknownAddressType(other))),
28 }
29 }
30}