pub struct Address(/* private fields */);Expand description
A Solana address (public key): 32 bytes, transparent layout.
This is part of the Hopper runtime type surface. Backends convert to and from this type at system boundaries.
Implementations§
Source§impl Address
impl Address
Sourcepub const fn new_from_array(bytes: [u8; 32]) -> Self
pub const fn new_from_array(bytes: [u8; 32]) -> Self
Construct from a raw byte array (alias for compatibility).
Source§impl Address
impl Address
Sourcepub fn as_upstream<T>(&self) -> &Twhere
T: TransparentAddress,
pub fn as_upstream<T>(&self) -> &Twhere
T: TransparentAddress,
Zero-cost borrow as a reference to any #[repr(transparent)]
32-byte type that shares layout with [u8; 32].
This is the preferred way to pass a Hopper Address where an
upstream reference is expected (e.g. &pinocchio::Address or
&Pubkey).
§Safety
Safe because Address is #[repr(transparent)] over [u8; 32]
and any upstream 32-byte address type shares this layout.
Sourcepub fn from_upstream<T>(upstream: &T) -> &Addresswhere
T: TransparentAddress,
pub fn from_upstream<T>(upstream: &T) -> &Addresswhere
T: TransparentAddress,
Construct a Hopper Address reference from any #[repr(transparent)]
32-byte address type.
Trait Implementations§
Source§impl Ord for Address
impl Ord for Address
Source§impl PartialOrd for Address
impl PartialOrd for Address
impl Copy for Address
impl Eq for Address
impl Pod for Address
Available on crate feature
hopper-native-backend only.impl Pod for Address
impl StructuralPartialEq for Address
impl TransparentAddress 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 UnsafeUnpin 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> CheckedBitPattern for Twhere
T: AnyBitPattern,
impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
Source§type Bits = T
type Bits = T
Self must have the same layout as the specified Bits except for
the possible invalid bit patterns being checked during
is_valid_bit_pattern.Source§fn is_valid_bit_pattern(_bits: &T) -> bool
fn is_valid_bit_pattern(_bits: &T) -> bool
If this function returns true, then it must be valid to reinterpret
bits
as &Self.