@@ -22,49 +22,12 @@ use solana_program::instruction::AccountMeta;
2222use solana_program:: program_error:: ProgramError ;
2323use solana_program:: pubkey:: Pubkey ;
2424use std:: cell:: { Ref , RefMut } ;
25- use std:: convert:: Infallible ;
2625use std:: slice;
2726
2827/// A set of accounts that can be used as input to an instruction.
2928pub trait AccountSet < ' info > {
3029 /// Sets account cache
3130 fn set_account_cache ( & mut self , _syscalls : & mut impl SyscallAccountCache < ' info > ) { }
32-
33- fn try_to_accounts < ' a , E > (
34- & ' a self ,
35- add_account : impl FnMut ( & ' a AccountInfo < ' info > ) -> Result < ( ) , E > ,
36- ) -> Result < ( ) , E >
37- where
38- ' info : ' a ;
39-
40- /// Add all the accounts in this set using `add_account`.
41- fn to_accounts < ' a > ( & ' a self , mut add_account : impl FnMut ( & ' a AccountInfo < ' info > ) )
42- where
43- ' info : ' a ,
44- {
45- self . try_to_accounts :: < Infallible > ( |a| {
46- add_account ( a) ;
47- Ok ( ( ) )
48- } )
49- . unwrap ( ) ;
50- }
51-
52- /// Gets a vector of all the accounts in this set.
53- fn to_accounts_vec < ' a > ( & ' a self ) -> Vec < & ' a AccountInfo < ' info > > {
54- let mut out = Vec :: new ( ) ;
55- self . to_accounts ( |acc| out. push ( acc) ) ;
56- out
57- }
58-
59- /// Add all accounts in this set using `add_account_meta`.
60- fn to_account_metas ( & self , add_account_meta : impl FnMut ( AccountMeta ) ) ;
61-
62- /// Gets a vector of all the account metas in this set.
63- fn to_account_metas_vec ( & self ) -> Vec < AccountMeta > {
64- let mut out = Vec :: new ( ) ;
65- self . to_account_metas ( |acc| out. push ( acc) ) ;
66- out
67- }
6831}
6932
7033/// Convenience methods for decoding and validating a list of [`AccountInfo`]s to an [`AccountSet`]. Performs
0 commit comments