1use {
2 crate::HandlerContext,
3 solana_account_view::AccountView,
4 solana_address::Address,
5 typhoon_errors::Error,
6 typhoon_traits::{Accessor, BytemuckStrategy},
7};
8
9pub type ArgData<'a, T, S> = <S as Accessor<'a, T>>::Data;
10
11pub struct Arg<'a, T, S = BytemuckStrategy>(pub ArgData<'a, T, S>)
12where
13 S: Accessor<'a, T>;
14
15impl<'c, T, S> HandlerContext<'_, '_, 'c> for Arg<'c, T, S>
16where
17 S: Accessor<'c, T>,
18{
19 #[inline(always)]
20 fn from_entrypoint(
21 _program_id: &Address,
22 _accounts: &mut &[AccountView],
23 instruction_data: &mut &'c [u8],
24 ) -> Result<Self, Error> {
25 Ok(Self(S::read(instruction_data)?))
26 }
27}