Skip to main content

typhoon_accounts/accounts/
unchecked.rs

1use {
2    crate::{FromAccountInfo, ReadableAccount},
3    solana_account_view::AccountView,
4    typhoon_errors::Error,
5};
6
7pub struct UncheckedAccount<'a> {
8    info: &'a AccountView,
9}
10
11impl<'a> FromAccountInfo<'a> for UncheckedAccount<'a> {
12    #[inline(always)]
13    fn try_from_info(info: &'a AccountView) -> Result<Self, Error> {
14        Ok(UncheckedAccount { info })
15    }
16}
17
18impl<'a> From<UncheckedAccount<'a>> for &'a AccountView {
19    #[inline(always)]
20    fn from(value: UncheckedAccount<'a>) -> Self {
21        value.info
22    }
23}
24
25impl AsRef<AccountView> for UncheckedAccount<'_> {
26    #[inline(always)]
27    fn as_ref(&self) -> &AccountView {
28        self.info
29    }
30}
31
32impl ReadableAccount for UncheckedAccount<'_> {}