From aaadbcbdd6b4eafaf1ff73c82755014a5cf5c13e Mon Sep 17 00:00:00 2001 From: Paul Schaaf Date: Sun, 19 Dec 2021 19:00:12 +0100 Subject: [PATCH 1/2] lang: implement AsRef for Account<'a, T> --- CHANGELOG.md | 1 + lang/src/accounts/account.rs | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9df4351507..9bc69ac109 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ incremented for features. * lang: Add `programdata_address: Option` field to `Program` account. Will be populated if account is a program owned by the upgradable bpf loader ([#1125](https://github.com/project-serum/anchor/pull/1125)) * lang,ts,ci,cli,docs: update solana toolchain to version 1.8.5([#1133](https://github.com/project-serum/anchor/pull/1133)) * 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>`([#1172](https://github.com/project-serum/anchor/pull/1172)) ### Breaking diff --git a/lang/src/accounts/account.rs b/lang/src/accounts/account.rs index f182d2e401..08bd755c5e 100644 --- a/lang/src/accounts/account.rs +++ b/lang/src/accounts/account.rs @@ -156,6 +156,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; From 7977001918498d0af240396bd3311b487dc6d10b Mon Sep 17 00:00:00 2001 From: Paul Schaaf Date: Sun, 19 Dec 2021 19:09:15 +0100 Subject: [PATCH 2/2] docs: fix pull request number --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9bc69ac109..a64ae95181 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,7 +20,7 @@ incremented for features. * lang: Add `programdata_address: Option` field to `Program` account. Will be populated if account is a program owned by the upgradable bpf loader ([#1125](https://github.com/project-serum/anchor/pull/1125)) * lang,ts,ci,cli,docs: update solana toolchain to version 1.8.5([#1133](https://github.com/project-serum/anchor/pull/1133)) * 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>`([#1172](https://github.com/project-serum/anchor/pull/1172)) +* lang: Implement `AsRef` for `Account<'a, T>`([#1173](https://github.com/project-serum/anchor/pull/1173)) ### Breaking