Skip to main content

ProductionControl

Struct ProductionControl 

Source
pub struct ProductionControl<'a> { /* private fields */ }
Expand description

Allocation and cancellation inputs borrowed for one production call. An ordinary call has no allowance or cancellation scope; a controlled call preserves both the original retained owner and the invoking reader.

Implementations§

Source§

impl<'a> ProductionControl<'a>

Source

pub const fn uncontrolled() -> Self

Source

pub fn new( budget: &'a MemoryBudget, original: &'a CancellationToken, invoking: &'a CancellationToken, ) -> Self

Source

pub fn budget(&self) -> Option<&'a MemoryBudget>

Source

pub fn check_cancellation(&self) -> Result<(), QueryCancelled>

Source

pub fn check(&self) -> Result<(), ValueRetentionError>

Source

pub fn empty_reservation(&self) -> Option<MemoryReservation>

Source

pub fn reserve( &self, bytes: usize, ) -> Result<Option<MemoryReservation>, ValueRetentionError>

Admit an explicitly known allocation layout before its constructor runs.

Source

pub fn combine( &self, left: Option<MemoryReservation>, right: Option<MemoryReservation>, ) -> Option<MemoryReservation>

Transfer two leases for allocations already owned by the same composite result. This does not produce, copy or replace a value.

Source

pub fn finish<T>( &self, value: T, memory: Option<MemoryReservation>, ) -> Result<Produced<T>, ValueRetentionError>

Associate a value with leases acquired by its constructors. Every owned allocation must already belong to the supplied reservation. The explicit pair prevents a representation-changing closure from silently introducing new payloads; callers must construct and admit those payloads at their owner.

Source

pub fn retain_external_value( &self, value: Value, ) -> Result<Produced<Value>, ValueRetentionError>

Accept a completed value from an external producer whose construction is outside this resource scope. This admission boundary retains its exposed owned capacities without copying; built-in constructors must instead reserve before allocating. The value precedes its accumulating lease on every error path.

Source

pub fn copy_value( &self, value: &Value, ) -> Result<Produced<Value>, ValueRetentionError>

Source

pub fn copy_text( &self, text: &str, ) -> Result<Produced<String>, ValueRetentionError>

Source

pub fn format( &self, arguments: Arguments<'_>, ) -> Result<Produced<String>, ValueRetentionError>

Trait Implementations§

Source§

impl<'a> Clone for ProductionControl<'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 ProductionControl<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for ProductionControl<'a>

§

impl<'a> RefUnwindSafe for ProductionControl<'a>

§

impl<'a> Send for ProductionControl<'a>

§

impl<'a> Sync for ProductionControl<'a>

§

impl<'a> Unpin for ProductionControl<'a>

§

impl<'a> UnsafeUnpin for ProductionControl<'a>

§

impl<'a> UnwindSafe for ProductionControl<'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.