pub enum Caller {
Initiator {
account_hash: AccountHash,
},
Entity {
package_hash: PackageHash,
entity_addr: EntityAddr,
},
SmartContract {
contract_package_hash: ContractPackageHash,
contract_hash: ContractHash,
},
}Expand description
Identity of a calling entity.
Variants§
Initiator
Initiator (calling account)
Fields
§
account_hash: AccountHashThe account hash of the caller
Entity
Entity (smart contract / system contract)
SmartContract
Fields
§
contract_package_hash: ContractPackageHashThe contract package hash.
§
contract_hash: ContractHashThe contract hash.
Implementations§
Source§impl Caller
impl Caller
Sourcepub fn initiator(account_hash: AccountHash) -> Self
pub fn initiator(account_hash: AccountHash) -> Self
Creates a Caller::Initiator. This represents a call into session code, and
should only ever happen once in a call stack.
Sourcepub fn entity(package_hash: PackageHash, entity_addr: EntityAddr) -> Self
pub fn entity(package_hash: PackageHash, entity_addr: EntityAddr) -> Self
Creates a ['Caller::Entity]. This represents a call into a contract with
EntryPointType::Called.
pub fn smart_contract( contract_package_hash: ContractPackageHash, contract_hash: ContractHash, ) -> Self
Sourcepub fn contract_hash(&self) -> Option<HashAddr>
pub fn contract_hash(&self) -> Option<HashAddr>
Gets the HashAddr for both stored session and stored contract variants.
Trait Implementations§
Source§impl From<&Caller> for CallStackElement
impl From<&Caller> for CallStackElement
Source§impl ToBytes for Caller
impl ToBytes for Caller
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<Caller> for CallerInfo
impl TryFrom<Caller> for CallerInfo
impl Copy for Caller
impl Eq for Caller
impl StructuralPartialEq for Caller
Auto Trait Implementations§
impl Freeze for Caller
impl RefUnwindSafe for Caller
impl Send for Caller
impl Sync for Caller
impl Unpin for Caller
impl UnwindSafe for Caller
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
Converts
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>
Converts
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 more