mod from_accounts;
mod multi_indexable;
mod single_indexable;
mod validate_argument;
pub use from_accounts::*;
pub use multi_indexable::*;
pub use single_indexable::*;
pub use validate_argument::*;
pub use cruiser_derive::AccountArgument;
use solana_program::pubkey::Pubkey;
use crate::CruiserResult;
pub trait AccountArgument: Sized {
type AccountInfo;
fn write_back(self, program_id: &Pubkey) -> CruiserResult<()>;
fn add_keys(&self, add: impl FnMut(Pubkey) -> CruiserResult<()>) -> CruiserResult<()>;
fn keys(&self) -> CruiserResult<Vec<Pubkey>> {
let mut out = Vec::new();
self.add_keys(|key| {
out.push(key);
Ok(())
})?;
Ok(out)
}
}