pub enum Address {
Account(AccountHash),
Contract(ContractPackageHash),
}Expand description
An enum representing an AccountHash or a ContractPackageHash.
Variants§
Account(AccountHash)
Represents an account hash.
Contract(ContractPackageHash)
Represents a contract package hash.
Implementations§
Source§impl Address
impl Address
Sourcepub const fn new(input: &'static str) -> OdraResult<Self>
pub const fn new(input: &'static str) -> OdraResult<Self>
Creates a new Address from a hex-encoded string.
Sourcepub fn as_account_hash(&self) -> Option<&AccountHash>
pub fn as_account_hash(&self) -> Option<&AccountHash>
Returns the inner account hash if self is the Account variant.
Sourcepub fn as_contract_package_hash(&self) -> Option<&ContractPackageHash>
pub fn as_contract_package_hash(&self) -> Option<&ContractPackageHash>
Returns the inner contract hash if self is the Contract variant.
Sourcepub fn as_package_hash(&self) -> Option<PackageHash>
pub fn as_package_hash(&self) -> Option<PackageHash>
Returns the inner contract hash as a PackageHash.
Sourcepub fn is_contract(&self) -> bool
pub fn is_contract(&self) -> bool
Returns true if the address is a contract address.
Sourcepub fn to_formatted_string(&self) -> String
pub fn to_formatted_string(&self) -> String
Returns a formatted string representation of the address.
Trait Implementations§
Source§impl Addressable for Address
impl Addressable for Address
Source§impl<'de> Deserialize<'de> for Address
impl<'de> Deserialize<'de> for Address
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<AccountHash> for Address
impl From<AccountHash> for Address
Source§fn from(account_hash: AccountHash) -> Self
fn from(account_hash: AccountHash) -> Self
Converts to this type from the input type.
Source§impl From<ContractPackageHash> for Address
impl From<ContractPackageHash> for Address
Source§fn from(contract_package_hash: ContractPackageHash) -> Self
fn from(contract_package_hash: ContractPackageHash) -> Self
Converts to this type from the input type.
Source§impl From<PackageHash> for Address
impl From<PackageHash> for Address
Source§fn from(package_hash: PackageHash) -> Self
fn from(package_hash: PackageHash) -> Self
Converts to this type from the input type.
Source§impl Ord for Address
impl Ord for Address
Source§impl PartialOrd for Address
impl PartialOrd for Address
Source§impl ToBytes for Address
impl ToBytes for Address
Source§fn serialized_length(&self) -> usize
fn serialized_length(&self) -> usize
Returns the length of the
Vec<u8> which would be returned from a successful call to
to_bytes() or into_bytes(). The data is not actually serialized, so this call is
relatively cheap.impl Copy for Address
impl Eq for Address
impl StructuralPartialEq for Address
Auto Trait Implementations§
impl Freeze for Address
impl RefUnwindSafe for Address
impl Send for Address
impl Sync for Address
impl Unpin for Address
impl UnwindSafe for Address
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> EntrypointArgument for T
impl<T> EntrypointArgument for T
Source§fn is_required() -> bool
fn is_required() -> bool
Returns
true if the argument is required.Source§fn insert_runtime_arg(self, name: &str, args: &mut RuntimeArgs)
fn insert_runtime_arg(self, name: &str, args: &mut RuntimeArgs)
Inserts the argument into the runtime args.
Source§fn unwrap(value: Option<T>, env: &ContractEnv) -> T
fn unwrap(value: Option<T>, env: &ContractEnv) -> T
Unwraps the argument from an Option.
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more