#[repr(C)]pub struct Address(/* private fields */);
Expand description
Logically the same as u128
, but aligned to 8
bytes instead of 16
.
Byte layout is the same as u128
, just alignment is different.
The first 20 bits correspond to the shard index (the least significant bits first), and the remaining 108 bits (the most significant bits first) are an address allocated within that shard. This way, an address will have a bunch of zeroes in the middle that is shrinking as more shards are added and more addresses are allocated.
Implementations§
Source§impl Address
impl Address
Sourcepub const SYSTEM_CODE: Self
pub const SYSTEM_CODE: Self
System contract for managing code of other contracts
Sourcepub const SYSTEM_BLOCK: Self
pub const SYSTEM_BLOCK: Self
System contract for managing block state
Sourcepub const SYSTEM_STATE: Self
pub const SYSTEM_STATE: Self
System contract for managing state of other contracts
Sourcepub const SYSTEM_NATIVE_TOKEN: Self
pub const SYSTEM_NATIVE_TOKEN: Self
System contract for native token
Sourcepub const SYSTEM_SIMPLE_WALLET_BASE: Self
pub const SYSTEM_SIMPLE_WALLET_BASE: Self
System simple wallet base contract that can be used by end user wallets
Sourcepub fn parse(s: &str) -> Option<(ShortHrp, Self)>
pub fn parse(s: &str) -> Option<(ShortHrp, Self)>
Parse address from a string formatted using Self::format()
.
Returns None
if address is formatted incorrectly.
Sourcepub fn format(&self, hrp: &ShortHrp) -> FormattedAddress
pub fn format(&self, hrp: &ShortHrp) -> FormattedAddress
Format address for presentation purposes
Sourcepub const fn system_address_allocator(shard_index: ShardIndex) -> Self
pub const fn system_address_allocator(shard_index: ShardIndex) -> Self
System contract for address allocation on a particular shard index
Trait Implementations§
Source§impl Ord for Address
impl Ord for Address
Source§impl PartialOrd for Address
impl PartialOrd for Address
Source§impl TrivialType for Address
impl TrivialType for Address
Source§const METADATA: &[u8]
const METADATA: &[u8]
IoTypeMetadataKind
for encoding details.const SIZE: u32 = _
Source§unsafe fn from_bytes(bytes: &[u8]) -> Option<&Self>
unsafe fn from_bytes(bytes: &[u8]) -> Option<&Self>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
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>
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>
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 moreSource§impl<T> IoType for Twhere
T: TrivialType,
impl<T> IoType for Twhere
T: TrivialType,
Source§const METADATA: &'static [u8] = T::METADATA
const METADATA: &'static [u8] = T::METADATA
IoTypeMetadataKind
for encoding detailsSource§type PointerType = T
type PointerType = T
IoType
represents