Struct casper_types::contracts::ContractHash
source · pub struct ContractHash(/* private fields */);
Expand description
A newtype wrapping a HashAddr
which references a Contract
in the global state.
Implementations§
source§impl ContractHash
impl ContractHash
sourcepub const fn new(value: HashAddr) -> ContractHash
pub const fn new(value: HashAddr) -> ContractHash
Constructs a new ContractHash
from the raw bytes of the contract hash.
sourcepub fn to_formatted_string(self) -> String
pub fn to_formatted_string(self) -> String
Formats the ContractHash
for users getting and putting.
sourcepub fn from_formatted_str(input: &str) -> Result<Self, FromStrError>
pub fn from_formatted_str(input: &str) -> Result<Self, FromStrError>
Parses a string formatted as per Self::to_formatted_string()
into a
ContractHash
.
Trait Implementations§
source§impl AsRef<[u8]> for ContractHash
impl AsRef<[u8]> for ContractHash
source§impl Clone for ContractHash
impl Clone for ContractHash
source§fn clone(&self) -> ContractHash
fn clone(&self) -> ContractHash
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for ContractHash
impl Debug for ContractHash
source§impl Default for ContractHash
impl Default for ContractHash
source§fn default() -> ContractHash
fn default() -> ContractHash
Returns the “default value” for a type. Read more
source§impl<'de> Deserialize<'de> for ContractHash
impl<'de> Deserialize<'de> for ContractHash
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 Display for ContractHash
impl Display for ContractHash
source§impl From<ContractHash> for Key
impl From<ContractHash> for Key
source§fn from(contract_hash: ContractHash) -> Key
fn from(contract_hash: ContractHash) -> Key
Converts to this type from the input type.
source§impl FromBytes for ContractHash
impl FromBytes for ContractHash
source§impl Hash for ContractHash
impl Hash for ContractHash
source§impl Ord for ContractHash
impl Ord for ContractHash
source§fn cmp(&self, other: &ContractHash) -> Ordering
fn cmp(&self, other: &ContractHash) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl PartialEq for ContractHash
impl PartialEq for ContractHash
source§fn eq(&self, other: &ContractHash) -> bool
fn eq(&self, other: &ContractHash) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd for ContractHash
impl PartialOrd for ContractHash
source§fn partial_cmp(&self, other: &ContractHash) -> Option<Ordering>
fn partial_cmp(&self, other: &ContractHash) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresource§impl Serialize for ContractHash
impl Serialize for ContractHash
source§impl ToBytes for ContractHash
impl ToBytes for ContractHash
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<&[u8]> for ContractHash
impl TryFrom<&[u8]> for ContractHash
§type Error = TryFromSliceForContractHashError
type Error = TryFromSliceForContractHashError
The type returned in the event of a conversion error.
impl Copy for ContractHash
impl Eq for ContractHash
impl StructuralEq for ContractHash
impl StructuralPartialEq for ContractHash
Auto Trait Implementations§
impl RefUnwindSafe for ContractHash
impl Send for ContractHash
impl Sync for ContractHash
impl Unpin for ContractHash
impl UnwindSafe for ContractHash
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> ToHex for Twhere
T: AsRef<[u8]>,
impl<T> ToHex for Twhere T: AsRef<[u8]>,
source§fn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex<U>(&self) -> Uwhere U: FromIterator<char>,
Encode the hex strict representing
self
into the result. Lower case
letters are used (e.g. f9b4ca
)source§fn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex_upper<U>(&self) -> Uwhere U: FromIterator<char>,
Encode the hex strict representing
self
into the result. Upper case
letters are used (e.g. F9B4CA
)