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 is_contract(&self) -> bool
pub fn is_contract(&self) -> bool
Returns true if the address is a contract 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 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.source§impl TryFrom<AccountHash> for Address
impl TryFrom<AccountHash> for Address
§type Error = AddressError
type Error = AddressError
The type returned in the event of a conversion error.
source§impl TryFrom<ContractPackageHash> for Address
impl TryFrom<ContractPackageHash> for Address
§type Error = AddressError
type Error = AddressError
The type returned in the event of a conversion error.
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§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit)source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit)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.