pub struct Address(/* private fields */);Expand description
The address of a Solana account.
Some account addresses are ed25519 public keys, with corresponding secret
keys that are managed off-chain. Often, though, account addresses do not
have corresponding secret keys — as with program derived
addresses — or the secret key is not relevant to the operation
of a program, and may have even been disposed of. As running Solana programs
can not safely create or manage secret keys, the full Keypair is not
defined in solana-program but in solana-sdk.
Implementations§
Source§impl Address
impl Address
pub const fn new_from_array(address_array: [u8; 32]) -> Address
Sourcepub const fn from_str_const(s: &str) -> Address
Available on crate feature decode only.
pub const fn from_str_const(s: &str) -> Address
decode only.Decode a string into an Address, usable in a const context
pub const fn to_bytes(&self) -> [u8; 32]
Sourcepub fn is_on_curve(&self) -> bool
Available on crate features curve25519 or syscalls only.
pub fn is_on_curve(&self) -> bool
curve25519 or syscalls only.Checks whether the given address lies on the Ed25519 curve.
On-curve addresses correspond to valid Ed25519 public keys (and therefore can have associated private keys). Off-curve addresses are typically used for program-derived addresses (PDAs).
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Address
impl<'de> Deserialize<'de> for Address
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Address, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Address, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Hash for Address
Custom impl of Hash for Address.
impl Hash for Address
Custom impl of Hash for Address.
This allows us to skip hashing the length of the address which is always the same anyway.
Source§impl Ord for Address
impl Ord for Address
Source§impl PartialOrd for Address
impl PartialOrd for Address
Source§impl<'de, WincodeConfig> SchemaRead<'de, WincodeConfig> for Addresswhere
WincodeConfig: Config,
impl<'de, WincodeConfig> SchemaRead<'de, WincodeConfig> for Addresswhere
WincodeConfig: Config,
Source§impl<WincodeConfig> SchemaWrite<WincodeConfig> for Addresswhere
WincodeConfig: Config,
impl<WincodeConfig> SchemaWrite<WincodeConfig> for Addresswhere
WincodeConfig: Config,
type Src = Address
Source§fn size_of(
src: &<Address as SchemaWrite<WincodeConfig>>::Src,
) -> Result<usize, WriteError>
fn size_of( src: &<Address as SchemaWrite<WincodeConfig>>::Src, ) -> Result<usize, WriteError>
Self::Src. Read moreSource§fn write(
writer: impl Writer,
src: &<Address as SchemaWrite<WincodeConfig>>::Src,
) -> Result<(), WriteError>
fn write( writer: impl Writer, src: &<Address as SchemaWrite<WincodeConfig>>::Src, ) -> Result<(), WriteError>
Self::Src to writer.Source§impl Serialize for Address
impl Serialize for Address
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Source§impl<WincodeConfig> ZeroCopy<WincodeConfig> for Address
impl<WincodeConfig> ZeroCopy<WincodeConfig> for Address
Source§fn from_bytes<'de>(bytes: &'de [u8], config: C) -> Result<&'de Self, ReadError>where
Self: Sized + SchemaRead<'de, C, Dst = Self>,
fn from_bytes<'de>(bytes: &'de [u8], config: C) -> Result<&'de Self, ReadError>where
Self: Sized + SchemaRead<'de, C, Dst = Self>,
crate::ZeroCopy::from_bytes, but allows the caller to provide a custom configuration.Source§fn from_bytes_mut<'de>(
bytes: &'de mut [u8],
config: C,
) -> Result<&'de mut Self, ReadError>where
Self: Sized + SchemaRead<'de, C, Dst = Self>,
fn from_bytes_mut<'de>(
bytes: &'de mut [u8],
config: C,
) -> Result<&'de mut Self, ReadError>where
Self: Sized + SchemaRead<'de, C, Dst = Self>,
crate::ZeroCopy::from_bytes_mut, but allows the caller to provide a custom configuration.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 UnsafeUnpin for Address
impl UnwindSafe for Address
Blanket Implementations§
Source§impl<T> AbiEnumVisitor for T
impl<T> AbiEnumVisitor for T
default fn visit_for_abi( &self, _digester: &mut AbiDigester, ) -> Result<AbiDigester, DigestError>
Source§impl<T> AbiEnumVisitor for Twhere
T: Serialize + AbiExample,
impl<T> AbiEnumVisitor for Twhere
T: Serialize + AbiExample,
default fn visit_for_abi( &self, digester: &mut AbiDigester, ) -> Result<AbiDigester, DigestError>
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,
Source§impl<'de, T> Deserialize<'de> for Twhere
T: SchemaRead<'de, Configuration>,
impl<'de, T> Deserialize<'de> for Twhere
T: SchemaRead<'de, Configuration>,
Source§impl<'de, T, C> Deserialize<'de, C> for Twhere
C: Config,
T: SchemaRead<'de, C>,
impl<'de, T, C> Deserialize<'de, C> for Twhere
C: Config,
T: SchemaRead<'de, C>,
Source§impl<T, C> DeserializeOwned<C> for Twhere
C: Config,
T: SchemaReadOwned<C>,
impl<T, C> DeserializeOwned<C> for Twhere
C: Config,
T: SchemaReadOwned<C>,
Source§fn deserialize_from<'de>(src: impl Reader<'de>) -> Result<Self::Dst, ReadError>
fn deserialize_from<'de>(src: impl Reader<'de>) -> Result<Self::Dst, ReadError>
Reader into a new Self::Dst.Source§fn deserialize_from_into<'de>(
src: impl Reader<'de>,
dst: &mut MaybeUninit<Self::Dst>,
) -> Result<(), ReadError>
fn deserialize_from_into<'de>( src: impl Reader<'de>, dst: &mut MaybeUninit<Self::Dst>, ) -> Result<(), ReadError>
Reader into dst.Source§impl<T> DeserializeOwned for Twhere
T: SchemaReadOwned<Configuration>,
impl<T> DeserializeOwned for Twhere
T: SchemaReadOwned<Configuration>,
Source§fn deserialize_from<'de>(src: impl Reader<'de>) -> Result<Self::Dst, ReadError>
fn deserialize_from<'de>(src: impl Reader<'de>) -> Result<Self::Dst, ReadError>
Reader into a new Self::Dst.Source§fn deserialize_from_into<'de>(
src: impl Reader<'de>,
dst: &mut MaybeUninit<Self::Dst>,
) -> Result<(), ReadError>
fn deserialize_from_into<'de>( src: impl Reader<'de>, dst: &mut MaybeUninit<Self::Dst>, ) -> Result<(), ReadError>
Reader into dst.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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> Pointable for T
impl<T> Pointable for T
Source§impl<T, C> Serialize<C> for T
impl<T, C> Serialize<C> for T
Source§fn serialize(src: &Self::Src, config: C) -> Result<Vec<u8>, WriteError>
fn serialize(src: &Self::Src, config: C) -> Result<Vec<u8>, WriteError>
alloc only.Vec of bytes.Source§fn serialize_into(
dst: impl Writer,
src: &Self::Src,
config: C,
) -> Result<(), WriteError>
fn serialize_into( dst: impl Writer, src: &Self::Src, config: C, ) -> Result<(), WriteError>
Writer.Source§fn serialized_size(src: &Self::Src, config: C) -> Result<u64, WriteError>
fn serialized_size(src: &Self::Src, config: C) -> Result<u64, WriteError>
Source§impl<T> Serialize for T
impl<T> Serialize for T
Source§fn serialize(src: &Self::Src) -> Result<Vec<u8>, WriteError>
fn serialize(src: &Self::Src) -> Result<Vec<u8>, WriteError>
alloc only.Vec of bytes.