Struct identity_iota::iota::block::address::Bech32Address
source · pub struct Bech32Address { /* private fields */ }
Expand description
An address and its network type.
Implementations§
source§impl Bech32Address
impl Bech32Address
sourcepub fn new(hrp: Hrp, inner: impl Into<Address>) -> Bech32Address
pub fn new(hrp: Hrp, inner: impl Into<Address>) -> Bech32Address
Creates a new address wrapper.
sourcepub fn try_new(
hrp: impl ConvertTo<Hrp>,
inner: impl Into<Address>
) -> Result<Bech32Address, Error>
pub fn try_new( hrp: impl ConvertTo<Hrp>, inner: impl Into<Address> ) -> Result<Bech32Address, Error>
Creates a new address wrapper by parsing a string HRP.
sourcepub fn into_inner(self) -> Address
pub fn into_inner(self) -> Address
Discard the hrp and get the address.
sourcepub fn try_from_str(address: impl AsRef<str>) -> Result<Bech32Address, Error>
pub fn try_from_str(address: impl AsRef<str>) -> Result<Bech32Address, Error>
Parses a bech32 address string.
Methods from Deref<Target = Address>§
sourcepub fn is_ed25519(&self) -> bool
pub fn is_ed25519(&self) -> bool
Checks whether the address is an Ed25519Address
.
sourcepub fn as_ed25519(&self) -> &Ed25519Address
pub fn as_ed25519(&self) -> &Ed25519Address
Gets the address as an actual Ed25519Address
.
PANIC: do not call on a non-ed25519 address.
sourcepub fn is_alias(&self) -> bool
pub fn is_alias(&self) -> bool
Checks whether the address is an AliasAddress
.
sourcepub fn as_alias(&self) -> &AliasAddress
pub fn as_alias(&self) -> &AliasAddress
Gets the address as an actual AliasAddress
.
PANIC: do not call on a non-alias address.
sourcepub fn is_nft(&self) -> bool
pub fn is_nft(&self) -> bool
Checks whether the address is an NftAddress
.
sourcepub fn as_nft(&self) -> &NftAddress
pub fn as_nft(&self) -> &NftAddress
Gets the address as an actual NftAddress
.
PANIC: do not call on a non-nft address.
sourcepub fn unlock(
&self,
unlock: &Unlock,
inputs: &[(&OutputId, &Output)],
context: &mut ValidationContext<'_>
) -> Result<(), ConflictReason>
pub fn unlock( &self, unlock: &Unlock, inputs: &[(&OutputId, &Output)], context: &mut ValidationContext<'_> ) -> Result<(), ConflictReason>
Trait Implementations§
source§impl AsRef<Address> for Bech32Address
impl AsRef<Address> for Bech32Address
source§impl Clone for Bech32Address
impl Clone for Bech32Address
source§fn clone(&self) -> Bech32Address
fn clone(&self) -> Bech32Address
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for Bech32Address
impl Debug for Bech32Address
source§impl Deref for Bech32Address
impl Deref for Bech32Address
source§impl<'de> Deserialize<'de> for Bech32Address
impl<'de> Deserialize<'de> for Bech32Address
source§fn deserialize<D>(
deserializer: D
) -> Result<Bech32Address, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D
) -> Result<Bech32Address, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
source§impl Display for Bech32Address
impl Display for Bech32Address
source§impl FromStr for Bech32Address
impl FromStr for Bech32Address
source§impl Hash for Bech32Address
impl Hash for Bech32Address
source§impl Ord for Bech32Address
impl Ord for Bech32Address
source§fn cmp(&self, other: &Bech32Address) -> Ordering
fn cmp(&self, other: &Bech32Address) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl PartialEq<&str> for Bech32Address
impl PartialEq<&str> for Bech32Address
source§impl PartialEq<String> for Bech32Address
impl PartialEq<String> for Bech32Address
source§impl PartialEq<str> for Bech32Address
impl PartialEq<str> for Bech32Address
source§impl PartialEq for Bech32Address
impl PartialEq for Bech32Address
source§fn eq(&self, other: &Bech32Address) -> bool
fn eq(&self, other: &Bech32Address) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd for Bech32Address
impl PartialOrd for Bech32Address
source§fn partial_cmp(&self, other: &Bech32Address) -> Option<Ordering>
fn partial_cmp(&self, other: &Bech32Address) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl Serialize for Bech32Address
impl Serialize for Bech32Address
source§fn serialize<S>(
&self,
s: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
s: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
impl Copy for Bech32Address
impl Eq for Bech32Address
impl StructuralPartialEq for Bech32Address
Auto Trait Implementations§
impl Freeze for Bech32Address
impl RefUnwindSafe for Bech32Address
impl Send for Bech32Address
impl Sync for Bech32Address
impl Unpin for Bech32Address
impl UnwindSafe for Bech32Address
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
source§impl<T> ConvertTo<Bech32Address> for T
impl<T> ConvertTo<Bech32Address> for T
fn convert(self) -> Result<Bech32Address, Error>
fn convert_unchecked(self) -> T
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.source§impl<T> FromJson for Twhere
T: for<'de> Deserialize<'de>,
impl<T> FromJson for Twhere
T: for<'de> Deserialize<'de>,
source§fn from_json(json: &(impl AsRef<str> + ?Sized)) -> Result<Self, Error>
fn from_json(json: &(impl AsRef<str> + ?Sized)) -> Result<Self, Error>
Self
from a string of JSON text.source§fn from_json_slice(json: &(impl AsRef<[u8]> + ?Sized)) -> Result<Self, Error>
fn from_json_slice(json: &(impl AsRef<[u8]> + ?Sized)) -> Result<Self, Error>
Self
from bytes of JSON text.source§fn from_json_value(json: Value) -> Result<Self, Error>
fn from_json_value(json: Value) -> Result<Self, Error>
Self
from a serde_json::Value
.source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> ToBech32Ext for T
impl<T> ToBech32Ext for T
source§fn try_to_bech32(self, hrp: impl ConvertTo<Hrp>) -> Result<Bech32Address, Error>
fn try_to_bech32(self, hrp: impl ConvertTo<Hrp>) -> Result<Bech32Address, Error>
Try to encode this address to a bech32 string with the given Human Readable Part as prefix.
source§fn to_bech32(self, hrp: Hrp) -> Bech32Address
fn to_bech32(self, hrp: Hrp) -> Bech32Address
Encodes this address to a bech32 string with the given Human Readable Part as prefix.
source§fn to_bech32_unchecked(self, hrp: impl ConvertTo<Hrp>) -> Bech32Address
fn to_bech32_unchecked(self, hrp: impl ConvertTo<Hrp>) -> Bech32Address
Encodes this address to a bech32 string with the given Human Readable Part as prefix without checking validity.
source§impl<T> ToJson for Twhere
T: Serialize,
impl<T> ToJson for Twhere
T: Serialize,
source§fn to_json_value(&self) -> Result<Value, Error>
fn to_json_value(&self) -> Result<Value, Error>
self
as a serde_json::Value
.