Skip to main content

TokenSink

Trait TokenSink 

Source
pub trait TokenSink<'a> {
    // Required method
    fn emit<const N: usize>(
        &mut self,
        data: &[u8],
        accounts: [InstructionAccount<'a>; N],
        views: [&'a AccountView<'a>; N],
        trailing: &[Trailing<'_, 'a>],
    ) -> ProgramResult;
}
Expand description

Where a builder’s encoded instruction goes.

Two sinks exist: the CPI itself (what every invoke* method uses) and TokenBatch, which collects several instructions for one Batch CPI. A builder never encodes differently for the two.

Required Methods§

Source

fn emit<const N: usize>( &mut self, data: &[u8], accounts: [InstructionAccount<'a>; N], views: [&'a AccountView<'a>; N], trailing: &[Trailing<'_, 'a>], ) -> ProgramResult

Receive one encoded instruction: its data, its fixed account metas and views in order, and zero or more trailing runs appended after them.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<'a, const DATA: usize, const ACCOUNTS: usize> TokenSink<'a> for TokenBatch<'a, DATA, ACCOUNTS>