aztec-nr - noir_aztec::transient

Struct TransientValue

pub struct TransientValue<T>
{ /* private fields */ }

A single value that lives for the duration of a single top-level PXE call.

Shared across all call frames of the same contract (private and utility alike) within one top-level PXE call. A contract can only ever access its own transient values; other contracts called within the same top-level PXE call cannot see them.

Values share the slot space with TransientArrays: a value and an array at the same slot alias each other, so use distinct slots.

Implementations

impl<T> TransientValue<T>

pub unconstrained fn at(slot: Field) -> Self

Returns a handle to the value at the given slot, which may already hold data stored by an earlier frame.

pub unconstrained fn store(self, value: T)
where T: Serialize

Stores a value at the given slot.

pub unconstrained fn read(self) -> Option<T>
where T: Deserialize

Returns the value previously stored at the slot with TransientValue::store, or Option::none() if the slot holds no value.

pub unconstrained fn delete(self)

Deletes the stored value. Does nothing if the slot holds no value.