pub struct Context<'a> { /* private fields */ }Expand description
Context wraps a single message request (and possibly response as well) along with the router callbacks necessary for making nested message calls.
Implementations§
Source§impl<'a> Context<'a>
impl<'a> Context<'a>
Sourcepub fn new(
context_info: ContextInfo,
host_callbacks: &'a dyn HostBackend,
) -> Context<'a>
pub fn new( context_info: ContextInfo, host_callbacks: &'a dyn HostBackend, ) -> Context<'a>
Create a new context from a message packet and host callbacks.
Sourcepub fn new_with_mem(
context_info: ContextInfo,
host_callbacks: &'a dyn HostBackend,
mem: &'a MemoryManager,
) -> Context<'a>
pub fn new_with_mem( context_info: ContextInfo, host_callbacks: &'a dyn HostBackend, mem: &'a MemoryManager, ) -> Context<'a>
Create a new context from a message packet and host callbacks with a pre-allocated memory manager.
Sourcepub fn self_account_id(&self) -> AccountID
pub fn self_account_id(&self) -> AccountID
This is the address of the account that is getting called. In a receiving account, this is the account’s own address.
Sourcepub fn caller(&self) -> AccountID
pub fn caller(&self) -> AccountID
This is the address of the account which is making the message call.
Sourcepub unsafe fn host_backend(&self) -> &dyn HostBackend
pub unsafe fn host_backend(&self) -> &dyn HostBackend
Get the host backend.
Sourcepub fn memory_manager(&self) -> &MemoryManager
pub fn memory_manager(&self) -> &MemoryManager
Get the memory manager.
Auto Trait Implementations§
impl<'a> !Freeze for Context<'a>
impl<'a> !RefUnwindSafe for Context<'a>
impl<'a> !Send for Context<'a>
impl<'a> !Sync for Context<'a>
impl<'a> Unpin for Context<'a>
impl<'a> !UnwindSafe for Context<'a>
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