lang: implement AsRef<T> for Account<'a, T> (#1173)
This commit is contained in:
parent
b5827c1b24
commit
51366441d2
|
@ -25,6 +25,7 @@ incremented for features.
|
|||
* lang: Add `set_inner` method to `Account<'a, T>` to enable easy updates ([#1177](https://github.com/project-serum/anchor/pull/1177)).
|
||||
* lang: Handle arrays with const as length ([#968](https://github.com/project-serum/anchor/pull/968)).
|
||||
* ts: Add optional commitment argument to `fetch` and `fetchMultiple` ([#1171](https://github.com/project-serum/anchor/pull/1171)).
|
||||
* lang: Implement `AsRef<T>` for `Account<'a, T>`([#1173](https://github.com/project-serum/anchor/pull/1173))
|
||||
|
||||
### Breaking
|
||||
|
||||
|
|
|
@ -160,6 +160,14 @@ impl<'info, T: AccountSerialize + AccountDeserialize + Owner + Clone> AsRef<Acco
|
|||
}
|
||||
}
|
||||
|
||||
impl<'info, T: AccountSerialize + AccountDeserialize + Owner + Clone> AsRef<T>
|
||||
for Account<'info, T>
|
||||
{
|
||||
fn as_ref(&self) -> &T {
|
||||
&self.account
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, T: AccountSerialize + AccountDeserialize + Owner + Clone> Deref for Account<'a, T> {
|
||||
type Target = T;
|
||||
|
||||
|
|
Loading…
Reference in New Issue