use crate::{decode::visitor::Visitor, error::DecodeError};
pub mod account_access;
pub mod transaction_access;
pub mod cpi_event_access;
pub mod decoder_impl;
pub use decoder_impl::*;
pub trait Decoder {
fn decode_account<V>(&self, visitor: V) -> Result<V::Value, DecodeError>
where
V: Visitor;
fn decode_transaction<V>(&self, visitor: V) -> Result<V::Value, DecodeError>
where
V: Visitor;
fn decode_anchor_cpi_events<V>(&self, visitor: V) -> Result<V::Value, DecodeError>
where
V: Visitor;
fn decode_owned_data<V>(&self, visitor: V) -> Result<V::Value, DecodeError>
where
V: Visitor;
fn decode_bytes<V>(&self, visitor: V) -> Result<V::Value, DecodeError>
where
V: Visitor;
}
impl<D: Decoder> Decoder for &D {
fn decode_account<V>(&self, visitor: V) -> Result<V::Value, DecodeError>
where
V: Visitor,
{
(**self).decode_account(visitor)
}
fn decode_transaction<V>(&self, visitor: V) -> Result<V::Value, DecodeError>
where
V: Visitor,
{
(**self).decode_transaction(visitor)
}
fn decode_anchor_cpi_events<V>(&self, visitor: V) -> Result<V::Value, DecodeError>
where
V: Visitor,
{
(**self).decode_anchor_cpi_events(visitor)
}
fn decode_owned_data<V>(&self, visitor: V) -> Result<V::Value, DecodeError>
where
V: Visitor,
{
(**self).decode_owned_data(visitor)
}
fn decode_bytes<V>(&self, visitor: V) -> Result<V::Value, DecodeError>
where
V: Visitor,
{
(**self).decode_bytes(visitor)
}
}