anchor/lang/src/vec.rs

20 lines
625 B
Rust

use crate::{ToAccountInfos, ToAccountMetas};
use solana_program::account_info::AccountInfo;
use solana_program::instruction::AccountMeta;
impl<'info, T: ToAccountInfos<'info>> ToAccountInfos<'info> for Vec<T> {
fn to_account_infos(&self) -> Vec<AccountInfo<'info>> {
self.iter()
.flat_map(|item| item.to_account_infos())
.collect()
}
}
impl<T: ToAccountMetas> ToAccountMetas for Vec<T> {
fn to_account_metas(&self, is_signer: Option<bool>) -> Vec<AccountMeta> {
self.iter()
.flat_map(|item| (*item).to_account_metas(is_signer))
.collect()
}
}