pub struct ContractId(/* private fields */);Expand description
A contract-id used to itentify different SmartContracts in the borderless-ecosystem.
These ids are version 8 uuids, where
the first four bits of the uuid are set to 0xc, to indicate that it is a contract-id and not another uuid based id.
Example:
cfc23cb3-f447-8107-8f93-9bfb8e1d157dAll uuid-based ids used in the borderless-ecosystem have a different prefix, based on what the id is used for. This mechanism ensures that you cannot mistake a contract-id for e.g. a process-id and vice versa. Even if you convert the contract-id back into a uuid and the result into a process-id, the results are different.
The implementation of the IDs is compliant with RFC9562, as we utilize standard version 8 uuids.
Implementations§
Source§impl ContractId
impl ContractId
Sourcepub fn into_uuid(self) -> Uuid
pub fn into_uuid(self) -> Uuid
Converts the ID into a uuid::Uuid
pub fn from_bytes(bytes: [u8; 16]) -> ContractId
pub fn from_slice(slice: &[u8]) -> Result<ContractId, TryFromSliceError>
Sourcepub fn into_bytes(self) -> [u8; 16]
pub fn into_bytes(self) -> [u8; 16]
Returns the underlying bytes
Sourcepub fn merge(&self, other: &ContractId) -> [u8; 16]
pub fn merge(&self, other: &ContractId) -> [u8; 16]
Merges two IDs commutatively
Can be used to construct database keys.
Sourcepub fn merge_compact(&self, other: &ContractId) -> u64
pub fn merge_compact(&self, other: &ContractId) -> u64
Merges and Compacts two IDs into a u64
Can be used to construct database keys.
Trait Implementations§
Source§impl AsRef<[u8]> for ContractId
impl AsRef<[u8]> for ContractId
Source§impl CallMethod for ContractId
impl CallMethod for ContractId
fn call_method(&self, method_name: &str) -> CallBuilder<CBInit>
Source§impl Clone for ContractId
impl Clone for ContractId
Source§fn clone(&self) -> ContractId
fn clone(&self) -> ContractId
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more