Enum casper_types::Key
source · pub enum Key {
Account(AccountHash),
Hash(HashAddr),
URef(URef),
Transfer(TransferAddr),
DeployInfo(DeployHash),
EraInfo(EraId),
Balance(URefAddr),
Bid(AccountHash),
Withdraw(AccountHash),
Dictionary(DictionaryAddr),
SystemContractRegistry,
EraSummary,
}Expand description
The type under which data (e.g. CLValues, smart contracts, user accounts)
are indexed on the network.
Variants§
Account(AccountHash)
A Key under which a user account is stored.
Hash(HashAddr)
A Key under which a smart contract is stored and which is the pseudo-hash of the
contract.
URef(URef)
A Key which is a URef, under which most types of data can be stored.
Transfer(TransferAddr)
A Key under which we store a transfer.
DeployInfo(DeployHash)
A Key under which we store a deploy info.
EraInfo(EraId)
A Key under which we store an era info.
Balance(URefAddr)
A Key under which we store a purse balance.
Bid(AccountHash)
A Key under which we store bid information
Withdraw(AccountHash)
A Key under which we store unbond information.
Dictionary(DictionaryAddr)
A Key variant whose value is derived by hashing URefs address and arbitrary data.
SystemContractRegistry
A Key variant under which system contract hashes are stored.
EraSummary
A Key under which we store current era info.
Implementations§
source§impl Key
impl Key
sourcepub const fn max_serialized_length() -> usize
pub const fn max_serialized_length() -> usize
Returns the maximum size a Key can be serialized into.
sourcepub fn normalize(self) -> Key
pub fn normalize(self) -> Key
If self is of type Key::URef, returns self with the
AccessRights stripped from the wrapped URef, otherwise
returns self unmodified.
sourcepub fn to_formatted_string(self) -> String
pub fn to_formatted_string(self) -> String
Returns a human-readable version of self, with the inner bytes encoded to Base16.
sourcepub fn from_formatted_str(input: &str) -> Result<Key, FromStrError>
pub fn from_formatted_str(input: &str) -> Result<Key, FromStrError>
Parses a string formatted as per Self::to_formatted_string() into a Key.
sourcepub fn into_account(self) -> Option<AccountHash>
pub fn into_account(self) -> Option<AccountHash>
Returns the inner bytes of self if self is of type Key::Account, otherwise returns
None.
sourcepub fn into_hash(self) -> Option<HashAddr>
pub fn into_hash(self) -> Option<HashAddr>
Returns the inner bytes of self if self is of type Key::Hash, otherwise returns
None.
sourcepub fn as_uref_mut(&mut self) -> Option<&mut URef>
pub fn as_uref_mut(&mut self) -> Option<&mut URef>
sourcepub fn as_balance(&self) -> Option<&URefAddr>
pub fn as_balance(&self) -> Option<&URefAddr>
Returns a reference to the inner URefAddr if self is of type Key::Balance,
otherwise returns None.
sourcepub fn as_dictionary(&self) -> Option<&DictionaryAddr>
pub fn as_dictionary(&self) -> Option<&DictionaryAddr>
Returns a reference to the inner DictionaryAddr if self is of type
Key::Dictionary, otherwise returns None.
sourcepub fn dictionary(seed_uref: URef, dictionary_item_key: &[u8]) -> Key
pub fn dictionary(seed_uref: URef, dictionary_item_key: &[u8]) -> Key
Creates a new Key::Dictionary variant based on a seed_uref and a dictionary_item_key
bytes.
Trait Implementations§
source§impl<'de> Deserialize<'de> for Key
impl<'de> Deserialize<'de> for Key
source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
source§impl Distribution<Key> for Standard
impl Distribution<Key> for Standard
source§fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> Key
fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> Key
T, using rng as the source of randomness.source§impl From<AccountHash> for Key
impl From<AccountHash> for Key
source§fn from(account_hash: AccountHash) -> Key
fn from(account_hash: AccountHash) -> Key
source§impl From<ContractHash> for Key
impl From<ContractHash> for Key
source§fn from(contract_hash: ContractHash) -> Key
fn from(contract_hash: ContractHash) -> Key
source§impl From<ContractPackageHash> for Key
impl From<ContractPackageHash> for Key
source§fn from(package_hash: ContractPackageHash) -> Key
fn from(package_hash: ContractPackageHash) -> Key
source§impl From<ContractWasmHash> for Key
impl From<ContractWasmHash> for Key
source§fn from(wasm_hash: ContractWasmHash) -> Key
fn from(wasm_hash: ContractWasmHash) -> Key
source§impl From<TransferAddr> for Key
impl From<TransferAddr> for Key
source§fn from(transfer_addr: TransferAddr) -> Key
fn from(transfer_addr: TransferAddr) -> Key
source§impl Ord for Key
impl Ord for Key
source§impl PartialOrd<Key> for Key
impl PartialOrd<Key> for Key
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self and other) and is used by the <=
operator. Read moresource§impl ToBytes for Key
impl ToBytes for Key
source§fn serialized_length(&self) -> usize
fn serialized_length(&self) -> usize
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 Key
impl Eq for Key
impl StructuralEq for Key
impl StructuralPartialEq for Key
Auto Trait Implementations§
impl RefUnwindSafe for Key
impl Send for Key
impl Sync for Key
impl Unpin for Key
impl UnwindSafe for Key
Blanket Implementations§
§impl<T> Conv for T
impl<T> Conv for T
§impl<T> FmtForward for T
impl<T> FmtForward for T
§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where Self: Binary,
self to use its Binary implementation when Debug-formatted.§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where Self: Display,
self to use its Display implementation when
Debug-formatted.§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where Self: Octal,
self to use its Octal implementation when Debug-formatted.§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.§impl<T> Pipe for T
impl<T> Pipe for T
§impl<T> PipeAsRef for T
impl<T> PipeAsRef for T
§impl<T> PipeBorrow for T
impl<T> PipeBorrow for T
§impl<T> PipeDeref for T
impl<T> PipeDeref for T
§impl<T> PipeRef for T
impl<T> PipeRef for T
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere R: 'a,
§fn pipe_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere R: 'a,
§impl<T> Tap for T
impl<T> Tap for T
§fn tap<F, R>(self, func: F) -> Selfwhere
F: FnOnce(&Self) -> R,
fn tap<F, R>(self, func: F) -> Selfwhere F: FnOnce(&Self) -> R,
§fn tap_dbg<F, R>(self, func: F) -> Selfwhere
F: FnOnce(&Self) -> R,
fn tap_dbg<F, R>(self, func: F) -> Selfwhere F: FnOnce(&Self) -> R,
tap in debug builds, and does nothing in release builds.§fn tap_mut<F, R>(self, func: F) -> Selfwhere
F: FnOnce(&mut Self) -> R,
fn tap_mut<F, R>(self, func: F) -> Selfwhere F: FnOnce(&mut Self) -> R,
§fn tap_mut_dbg<F, R>(self, func: F) -> Selfwhere
F: FnOnce(&mut Self) -> R,
fn tap_mut_dbg<F, R>(self, func: F) -> Selfwhere F: FnOnce(&mut Self) -> R,
tap_mut in debug builds, and does nothing in release builds.§impl<T, U> TapAsRef<U> for Twhere
U: ?Sized,
impl<T, U> TapAsRef<U> for Twhere U: ?Sized,
§fn tap_ref<F, R>(self, func: F) -> Selfwhere
Self: AsRef<T>,
F: FnOnce(&T) -> R,
fn tap_ref<F, R>(self, func: F) -> Selfwhere Self: AsRef<T>, F: FnOnce(&T) -> R,
§fn tap_ref_dbg<F, R>(self, func: F) -> Selfwhere
Self: AsRef<T>,
F: FnOnce(&T) -> R,
fn tap_ref_dbg<F, R>(self, func: F) -> Selfwhere Self: AsRef<T>, F: FnOnce(&T) -> R,
tap_ref in debug builds, and does nothing in release builds.§fn tap_ref_mut<F, R>(self, func: F) -> Selfwhere
Self: AsMut<T>,
F: FnOnce(&mut T) -> R,
fn tap_ref_mut<F, R>(self, func: F) -> Selfwhere Self: AsMut<T>, F: FnOnce(&mut T) -> R,
§fn tap_ref_mut_dbg<F, R>(self, func: F) -> Selfwhere
Self: AsMut<T>,
F: FnOnce(&mut T) -> R,
fn tap_ref_mut_dbg<F, R>(self, func: F) -> Selfwhere Self: AsMut<T>, F: FnOnce(&mut T) -> R,
tap_ref_mut in debug builds, and does nothing in release builds.§impl<T, U> TapBorrow<U> for Twhere
U: ?Sized,
impl<T, U> TapBorrow<U> for Twhere U: ?Sized,
§fn tap_borrow<F, R>(self, func: F) -> Selfwhere
Self: Borrow<T>,
F: FnOnce(&T) -> R,
fn tap_borrow<F, R>(self, func: F) -> Selfwhere Self: Borrow<T>, F: FnOnce(&T) -> R,
§fn tap_borrow_dbg<F, R>(self, func: F) -> Selfwhere
Self: Borrow<T>,
F: FnOnce(&T) -> R,
fn tap_borrow_dbg<F, R>(self, func: F) -> Selfwhere Self: Borrow<T>, F: FnOnce(&T) -> R,
tap_borrow in debug builds, and does nothing in release builds.§fn tap_borrow_mut<F, R>(self, func: F) -> Selfwhere
Self: BorrowMut<T>,
F: FnOnce(&mut T) -> R,
fn tap_borrow_mut<F, R>(self, func: F) -> Selfwhere Self: BorrowMut<T>, F: FnOnce(&mut T) -> R,
§fn tap_borrow_mut_dbg<F, R>(self, func: F) -> Selfwhere
Self: BorrowMut<T>,
F: FnOnce(&mut T) -> R,
fn tap_borrow_mut_dbg<F, R>(self, func: F) -> Selfwhere Self: BorrowMut<T>, F: FnOnce(&mut T) -> R,
tap_borrow_mut in debug builds, and does nothing in release
builds.§impl<T> TapDeref for T
impl<T> TapDeref for T
§fn tap_deref<F, R>(self, func: F) -> Selfwhere
Self: Deref,
F: FnOnce(&Self::Target) -> R,
fn tap_deref<F, R>(self, func: F) -> Selfwhere Self: Deref, F: FnOnce(&Self::Target) -> R,
self for inspection.§fn tap_deref_dbg<F, R>(self, func: F) -> Selfwhere
Self: Deref,
F: FnOnce(&Self::Target) -> R,
fn tap_deref_dbg<F, R>(self, func: F) -> Selfwhere Self: Deref, F: FnOnce(&Self::Target) -> R,
tap_deref in debug builds, and does nothing in release builds.§fn tap_deref_mut<F, R>(self, func: F) -> Selfwhere
Self: DerefMut,
F: FnOnce(&mut Self::Target) -> R,
fn tap_deref_mut<F, R>(self, func: F) -> Selfwhere Self: DerefMut, F: FnOnce(&mut Self::Target) -> R,
self for modification.§fn tap_deref_mut_dbg<F, R>(self, func: F) -> Selfwhere
Self: DerefMut,
F: FnOnce(&mut Self::Target) -> R,
fn tap_deref_mut_dbg<F, R>(self, func: F) -> Selfwhere Self: DerefMut, F: FnOnce(&mut Self::Target) -> R,
tap_deref_mut in debug builds, and does nothing in release
builds.