pub struct ContractRegister { /* private fields */ }Expand description
A struct representing a contract register that maps an address to a contract.
A register is a central place where all contracts are stored. It is used by the host side to manage and/or call contracts.
Implementations§
Source§impl ContractRegister
impl ContractRegister
Sourcepub fn add(&mut self, addr: Address, container: ContractContainer)
pub fn add(&mut self, addr: Address, container: ContractContainer)
Adds a contract to the register.
Sourcepub fn call(&self, addr: &Address, call_def: CallDef) -> OdraResult<Bytes>
pub fn call(&self, addr: &Address, call_def: CallDef) -> OdraResult<Bytes>
Calls the entry point with the given call definition.
Returns bytes representing the result of the call or an error if the address is not present in the register.
Sourcepub fn get(&self, addr: &Address) -> Option<&ContractContainer>
pub fn get(&self, addr: &Address) -> Option<&ContractContainer>
Returns the latest contract container for the given address.
Sourcepub fn get_name(&self, addr: &Address) -> Option<&str>
pub fn get_name(&self, addr: &Address) -> Option<&str>
Returns the name of the contract at the given address.
Sourcepub fn get_address(&self, name: &str) -> Option<Address>
pub fn get_address(&self, name: &str) -> Option<Address>
Returns the address of the contract with the given name.
Sourcepub fn get_mut(&mut self, addr: &Address) -> Option<&mut ContractContainer>
pub fn get_mut(&mut self, addr: &Address) -> Option<&mut ContractContainer>
Returns the latest contract container for the given address.
Sourcepub fn post_install(&mut self, addr: &Address)
pub fn post_install(&mut self, addr: &Address)
Post install hook.
Trait Implementations§
Source§impl Default for ContractRegister
impl Default for ContractRegister
Source§fn default() -> ContractRegister
fn default() -> ContractRegister
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ContractRegister
impl !RefUnwindSafe for ContractRegister
impl !Send for ContractRegister
impl !Sync for ContractRegister
impl Unpin for ContractRegister
impl !UnwindSafe for ContractRegister
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> 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