pub struct Execution<'a> { /* private fields */ }Expand description
A borrowed aggregate account and original parser-session work ceiling.
Obtain this from crate::Reader::execution. Copies allocate nothing and
acquire no shared ownership. Scratch storage and work use the reader’s
current account; rebinding the account never resets the parser ceiling.
A parser-bound allocation cannot survive its borrowed owner:
ⓘ
use std::sync::Arc;
use structured_asn1::{Parser, memory::{Memory, MemoryAccount, Work}};
let mut scratch;
{
let parser = Parser::ber(Memory::new(Arc::new(MemoryAccount::new(1024, 1024))));
let reader = parser.read(&[], 0).unwrap();
scratch = reader.execution().vector();
scratch.try_push(42_u8).unwrap();
}
drop(scratch);Trait Implementations§
impl<'a> Copy for Execution<'a>
Source§impl Work for Execution<'_>
impl Work for Execution<'_>
Source§type Retained = Memory
type Retained = Memory
Storage ownership retained by the allocator independently of borrowed work.
Source§fn retain_storage(&self) -> Memory
fn retain_storage(&self) -> Memory
Source§fn into_storage_owner(self, retained: Memory) -> Memory
fn into_storage_owner(self, retained: Memory) -> Memory
Moves the existing account owner when finishing independently owned storage.
The sealed implementations preserve the account without cloning it.
Source§fn with_storage_owner(&self, memory: Memory) -> (Self, Memory)
fn with_storage_owner(&self, memory: Memory) -> (Self, Memory)
Attaches current work while moving an existing same-account owner.
The caller verifies account identity before transferring storage.
Source§fn charge_work(&self, amount: u64) -> Result<(), MemoryError>
fn charge_work(&self, amount: u64) -> Result<(), MemoryError>
Admits work before execution, against every applicable ceiling.
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for Execution<'a>
impl<'a> !Send for Execution<'a>
impl<'a> !Sync for Execution<'a>
impl<'a> !UnwindSafe for Execution<'a>
impl<'a> Freeze for Execution<'a>
impl<'a> Unpin for Execution<'a>
impl<'a> UnsafeUnpin for Execution<'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