diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d6f694bb..48c0cb6cd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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` for `Account<'a, T>`([#1173](https://github.com/project-serum/anchor/pull/1173)) ### Breaking diff --git a/lang/src/accounts/account.rs b/lang/src/accounts/account.rs index 7ce20e36d..600346585 100644 --- a/lang/src/accounts/account.rs +++ b/lang/src/accounts/account.rs @@ -160,6 +160,14 @@ impl<'info, T: AccountSerialize + AccountDeserialize + Owner + Clone> AsRef AsRef + 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;