lang: Add `AsRef` conversions for accounts to `AccountInfo` (#541)
This commit is contained in:
parent
c4e3dd2b5f
commit
c1109721b5
|
@ -87,6 +87,12 @@ impl<'info, T: AccountDeserialize + Clone> ToAccountInfo<'info> for CpiAccount<'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<'info, T: AccountDeserialize + Clone> AsRef<AccountInfo<'info>> for CpiAccount<'info, T> {
|
||||||
|
fn as_ref(&self) -> &AccountInfo<'info> {
|
||||||
|
&self.info
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl<'a, T: AccountDeserialize + Clone> Deref for CpiAccount<'a, T> {
|
impl<'a, T: AccountDeserialize + Clone> Deref for CpiAccount<'a, T> {
|
||||||
type Target = T;
|
type Target = T;
|
||||||
|
|
||||||
|
|
|
@ -162,6 +162,14 @@ impl<'info, T: AccountSerialize + AccountDeserialize + Clone> ToAccountInfo<'inf
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<'info, T: AccountSerialize + AccountDeserialize + Clone> AsRef<AccountInfo<'info>>
|
||||||
|
for ProgramAccount<'info, T>
|
||||||
|
{
|
||||||
|
fn as_ref(&self) -> &AccountInfo<'info> {
|
||||||
|
&self.inner.info
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl<'a, T: AccountSerialize + AccountDeserialize + Clone> Deref for ProgramAccount<'a, T> {
|
impl<'a, T: AccountSerialize + AccountDeserialize + Clone> Deref for ProgramAccount<'a, T> {
|
||||||
type Target = T;
|
type Target = T;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue