[TieredStorage] TieredReadableAccount::data() (#32433)
#### Problem While TieredReadableAccount implements ReadableAccount that already includes `fn data(&self) -> &'a [u8]`, a `data()` function that directly under TieredReadableAccount is still needed in order to correctly link the lifetime of the returned value and its member account_block. Otherwise, cargo will complain lifetime may not live long enough. #### Summary of Changes This PR adds TieredReadableAccount::data() that directly links the lifetime of its account_block to the returned value.
This commit is contained in:
parent
65e90ab0bc
commit
a58b84ce95
|
@ -41,6 +41,11 @@ impl<'a, M: TieredAccountMeta> TieredReadableAccount<'a, M> {
|
|||
pub fn write_version(&self) -> Option<StoredMetaWriteVersion> {
|
||||
self.meta.write_version(self.account_block)
|
||||
}
|
||||
|
||||
/// Returns the data associated to this account.
|
||||
pub fn data(&self) -> &'a [u8] {
|
||||
self.meta.account_data(self.account_block)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, M: TieredAccountMeta> ReadableAccount for TieredReadableAccount<'a, M> {
|
||||
|
@ -73,6 +78,6 @@ impl<'a, M: TieredAccountMeta> ReadableAccount for TieredReadableAccount<'a, M>
|
|||
|
||||
/// Returns the data associated to this account.
|
||||
fn data(&self) -> &'a [u8] {
|
||||
self.meta.account_data(self.account_block)
|
||||
self.data()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue