use anchor_lang::solana_program::pubkey::Pubkey;
use crate::{
decoder::{
account_access::AccountAccess, cpi_event_access::AnchorCPIEventsAccess,
transaction_access::TransactionAccess,
},
error::DecodeError,
};
pub trait Visitor: Sized {
type Value;
fn visit_account(self, account: impl AccountAccess) -> Result<Self::Value, DecodeError> {
_ = account;
Err(DecodeError::InvalidType(
"Unexpected type `Account`".to_string(),
))
}
fn visit_transaction(
self,
transaction: impl TransactionAccess,
) -> Result<Self::Value, DecodeError> {
_ = transaction;
Err(DecodeError::InvalidType(
"Unexpected type `Transaction`".to_string(),
))
}
fn visit_anchor_cpi_events<'a>(
self,
events: impl AnchorCPIEventsAccess<'a>,
) -> Result<Self::Value, DecodeError> {
_ = events;
Err(DecodeError::InvalidType(
"Unexpected type `AnchorCPIEvents`".to_string(),
))
}
fn visit_owned_data(
self,
program_id: &Pubkey,
data: &[u8],
) -> Result<Self::Value, DecodeError> {
_ = program_id;
_ = data;
Err(DecodeError::InvalidType(
"Unexpected type `OwnedData`".to_string(),
))
}
fn visit_bytes(self, data: &[u8]) -> Result<Self::Value, DecodeError> {
_ = data;
Err(DecodeError::InvalidType(
"Unexpected type `Bytes`".to_string(),
))
}
}