Skip to main content

Execution

Struct Execution 

Source
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§

Source§

impl<'a> Clone for Execution<'a>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Copy for Execution<'a>

Source§

impl<'a> Debug for Execution<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Work for Execution<'_>

Source§

type Retained = Memory

Storage ownership retained by the allocator independently of borrowed work.
Source§

fn retain_storage(&self) -> Memory

Keeps an allocation’s account alive even if its collection is forgotten. Owned Memory already holds that account; borrowed Execution supplies one owning handle per collection without allocating a new account.
Source§

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)

Attaches current work while moving an existing same-account owner. The caller verifies account identity before transferring storage.
Source§

fn memory(&self) -> &Memory

The account retaining allocated capacity.
Source§

fn charge_work(&self, amount: u64) -> Result<(), MemoryError>

Admits work before execution, against every applicable ceiling.
Source§

fn vector<T>(&self) -> OwnedVec<T, Self>

Creates empty accounted scratch retaining this execution boundary. Read more
Source§

fn map<K: HashWork, V>(&self) -> OwnedMap<K, V, Self>

Creates a bounded scratch map in this storage and execution domain. Hash/probes, table growth and value movement retain the same ceilings.

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.