verified_anchor/
account.rs1use core::marker::PhantomData;
6use core::ops::{Deref, DerefMut};
7use solana_program::account_info::AccountInfo;
8
9use crate::account_data::{AccountData, ProgramId};
10
11pub struct Account<'info, T: AccountData> {
15 pub info: &'info AccountInfo<'info>,
16 pub data: T,
17}
18
19impl<'info, T: AccountData> Deref for Account<'info, T> {
20 type Target = T;
21 fn deref(&self) -> &T { &self.data }
22}
23impl<'info, T: AccountData> DerefMut for Account<'info, T> {
24 fn deref_mut(&mut self) -> &mut T { &mut self.data }
25}
26
27pub struct Signer<'info> {
29 pub info: &'info AccountInfo<'info>,
30}
31
32pub struct Program<'info, P: ProgramId> {
34 pub info: &'info AccountInfo<'info>,
35 _phantom: PhantomData<P>,
36}
37impl<'info, P: ProgramId> Program<'info, P> {
38 pub fn new(info: &'info AccountInfo<'info>) -> Self {
40 Self { info, _phantom: PhantomData }
41 }
42}
43
44pub struct SystemAccount<'info> {
46 pub info: &'info AccountInfo<'info>,
47}
48
49pub struct UncheckedAccount<'info> {
52 pub info: &'info AccountInfo<'info>,
53}
54
55