Trait Visitor

Source
pub trait Visitor: Sized {
    type Value;

    // Provided methods
    fn visit_account(
        self,
        account: impl AccountAccess,
    ) -> Result<Self::Value, DecodeError> { ... }
    fn visit_anchor_cpi_events<'a>(
        self,
        events: impl AnchorCPIEventsAccess<'a>,
    ) -> Result<Self::Value, DecodeError> { ... }
    fn visit_owned_data(
        self,
        program_id: &Pubkey,
        data: &[u8],
    ) -> Result<Self::Value, DecodeError> { ... }
    fn visit_bytes(self, data: &[u8]) -> Result<Self::Value, DecodeError> { ... }
}
Expand description

Type that walks through a Decoder.

Required Associated Types§

Source

type Value

Value Type.

Provided Methods§

Source

fn visit_account( self, account: impl AccountAccess, ) -> Result<Self::Value, DecodeError>

Visit an account.

Source

fn visit_anchor_cpi_events<'a>( self, events: impl AnchorCPIEventsAccess<'a>, ) -> Result<Self::Value, DecodeError>

Visit Anchor CPI events.

Source

fn visit_owned_data( self, program_id: &Pubkey, data: &[u8], ) -> Result<Self::Value, DecodeError>

Visit data owned by a program.

It can be the data of an Event, an Account or an Instruction.

Source

fn visit_bytes(self, data: &[u8]) -> Result<Self::Value, DecodeError>

Visit bytes.

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§

Source§

impl<T> Visitor for AccountDeserializeVisitor<T>
where T: AccountDeserialize,

Source§

type Value = T

Source§

impl<T> Visitor for CPIEventVisitor<T>
where T: Event,

Source§

type Value = T

Source§

impl<T> Visitor for ZeroCopyVisitor<T>
where T: ZeroCopy,

Source§

type Value = T