aztec-nr - noir_aztec::state_vars

Trait StateVariable

pub trait StateVariable<let N: u32, Context> {
    // Required methods
    pub fn new(context: Context, storage_slot: Field) -> Self;
    pub fn get_storage_slot(self) -> Field;
}

A container for contract state.

All contract state is stored in state variables, and all state variables implement the StateVariable trait. For more information on the different types of state variables see the state_vars module.

Required methods

pub fn new(context: Context, storage_slot: Field) -> Self

Creates a state variable.

This function is automatically called by aztec-nr as the self object is created. Users are expected to only ever need to invoke it when using the #[storage_no_init] macro.

pub fn get_storage_slot(self) -> Field

Returns the state variable's storage slot.

Implementors

impl<Context, let InitialDelay: u64, let M: u32, T> StateVariable<M + 1, Context> for DelayedPublicMutable<T, InitialDelay, Context>
where DelayedPublicMutableValues<T, InitialDelay>: Packable<N = M>

impl<Context, K, V> StateVariable<1, Context> for Map<K, V, Context>

impl<Context, V> StateVariable<1, Context> for Owned<V, Context>

impl<Context, let M: u32, T> StateVariable<M + 1, Context> for PublicImmutable<T, Context>
where T: Packable<N = M>

impl<Context, let M: u32, T> StateVariable<M, Context> for PublicMutable<T, Context>
where T: Packable<N = M>

impl<Context, Note> StateVariable<1, Context> for SinglePrivateImmutable<Note, Context>

impl<Context, Note> StateVariable<1, Context> for SinglePrivateMutable<Note, Context>