pub struct HelperScope<'a, 'b> {
pub program: &'a Program,
pub invoke: RefCell<&'a mut InvokeScope>,
/* private fields */
}Expand description
Context passed to helpers while a program is executing.
Fields§
§program: &'a ProgramThe program being executed.
invoke: RefCell<&'a mut InvokeScope>Mutable per-invocation data for helpers.
Implementations§
Source§impl<'a, 'b> HelperScope<'a, 'b>
impl<'a, 'b> HelperScope<'a, 'b>
Sourcepub fn post_task(
&self,
task: impl Future<Output = impl FnOnce(&HelperScope<'_, '_>) -> Result<u64, ()> + 'static> + 'static,
)
pub fn post_task( &self, task: impl Future<Output = impl FnOnce(&HelperScope<'_, '_>) -> Result<u64, ()> + 'static> + 'static, )
Posts an async task to be run between timeslices.
Sourcepub fn with_resource_mut<'c, T: 'static, R>(
&'c self,
callback: impl FnOnce(Result<&mut T, ()>) -> R,
) -> R
pub fn with_resource_mut<'c, T: 'static, R>( &'c self, callback: impl FnOnce(Result<&mut T, ()>) -> R, ) -> R
Calls callback with a mutable resource of type T, if present.
Sourcepub fn user_memory(&self, ptr: u64, size: u64) -> Result<&[u8], ()>
pub fn user_memory(&self, ptr: u64, size: u64) -> Result<&[u8], ()>
Validates and returns an immutable view into user memory.
Sourcepub fn user_memory_mut<'c>(
&'c self,
ptr: u64,
size: u64,
) -> Result<MutableUserMemory<'a, 'b, 'c>, ()>
pub fn user_memory_mut<'c>( &'c self, ptr: u64, size: u64, ) -> Result<MutableUserMemory<'a, 'b, 'c>, ()>
Validates and returns a mutable view into user memory.
Auto Trait Implementations§
impl<'a, 'b> !Freeze for HelperScope<'a, 'b>
impl<'a, 'b> !RefUnwindSafe for HelperScope<'a, 'b>
impl<'a, 'b> !Send for HelperScope<'a, 'b>
impl<'a, 'b> !Sync for HelperScope<'a, 'b>
impl<'a, 'b> Unpin for HelperScope<'a, 'b>
impl<'a, 'b> !UnwindSafe for HelperScope<'a, 'b>
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