Trait StackProgram

Source
pub trait StackProgram<N: Network> {
    // Required methods
    fn program(&self) -> &Program<N>;
    fn program_id(&self) -> &ProgramID<N>;
    fn program_depth(&self) -> usize;
    fn program_address(&self) -> &Address<N>;
    fn get_external_stack(&self, program_id: &ProgramID<N>) -> Result<Arc<Self>>;
    fn get_finalize_cost(&self, function_name: &Identifier<N>) -> Result<u64>;
    fn get_function(&self, function_name: &Identifier<N>) -> Result<Function<N>>;
    fn get_function_ref(
        &self,
        function_name: &Identifier<N>,
    ) -> Result<&Function<N>>;
    fn get_number_of_calls(
        &self,
        function_name: &Identifier<N>,
    ) -> Result<usize>;
    fn sample_value<R: Rng + CryptoRng>(
        &self,
        burner_address: &Address<N>,
        value_type: &ValueType<N>,
        rng: &mut R,
    ) -> Result<Value<N>>;
    fn sample_record<R: Rng + CryptoRng>(
        &self,
        burner_address: &Address<N>,
        record_name: &Identifier<N>,
        record_nonce: Group<N>,
        rng: &mut R,
    ) -> Result<Record<N, Plaintext<N>>>;
    fn sample_record_using_tvk<R: Rng + CryptoRng>(
        &self,
        burner_address: &Address<N>,
        record_name: &Identifier<N>,
        tvk: Field<N>,
        index: Field<N>,
        rng: &mut R,
    ) -> Result<Record<N, Plaintext<N>>>;
}

Required Methods§

Source

fn program(&self) -> &Program<N>

Returns the program.

Source

fn program_id(&self) -> &ProgramID<N>

Returns the program ID.

Source

fn program_depth(&self) -> usize

Returns the program depth.

Source

fn program_address(&self) -> &Address<N>

Returns the program address.

Source

fn get_external_stack(&self, program_id: &ProgramID<N>) -> Result<Arc<Self>>

Returns the external stack for the given program ID.

Source

fn get_finalize_cost(&self, function_name: &Identifier<N>) -> Result<u64>

Returns the expected finalize cost for the given function name.

Source

fn get_function(&self, function_name: &Identifier<N>) -> Result<Function<N>>

Returns the function with the given function name.

Source

fn get_function_ref( &self, function_name: &Identifier<N>, ) -> Result<&Function<N>>

Returns a reference to the function with the given function name.

Source

fn get_number_of_calls(&self, function_name: &Identifier<N>) -> Result<usize>

Returns the expected number of calls for the given function name.

Source

fn sample_value<R: Rng + CryptoRng>( &self, burner_address: &Address<N>, value_type: &ValueType<N>, rng: &mut R, ) -> Result<Value<N>>

Samples a value for the given value_type.

Source

fn sample_record<R: Rng + CryptoRng>( &self, burner_address: &Address<N>, record_name: &Identifier<N>, record_nonce: Group<N>, rng: &mut R, ) -> Result<Record<N, Plaintext<N>>>

Returns a record for the given record name, with the given burner address and nonce.

Source

fn sample_record_using_tvk<R: Rng + CryptoRng>( &self, burner_address: &Address<N>, record_name: &Identifier<N>, tvk: Field<N>, index: Field<N>, rng: &mut R, ) -> Result<Record<N, Plaintext<N>>>

Returns a record for the given record name, deriving the nonce from tvk and index.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§