provide default impl of 'is_empty' (#24554)
This commit is contained in:
parent
28ed2a9df4
commit
3f7b8d3d2c
|
@ -16,7 +16,9 @@ pub trait StorableAccounts<'a, T: ReadableAccount + Sync>: Sync {
|
||||||
/// slot that all accounts are to be written to
|
/// slot that all accounts are to be written to
|
||||||
fn target_slot(&self) -> Slot;
|
fn target_slot(&self) -> Slot;
|
||||||
/// true if no accounts to write
|
/// true if no accounts to write
|
||||||
fn is_empty(&self) -> bool;
|
fn is_empty(&self) -> bool {
|
||||||
|
self.len() == 0
|
||||||
|
}
|
||||||
/// # accounts to write
|
/// # accounts to write
|
||||||
fn len(&self) -> usize;
|
fn len(&self) -> usize;
|
||||||
/// are there accounts from multiple slots
|
/// are there accounts from multiple slots
|
||||||
|
@ -38,9 +40,6 @@ impl<'a, T: ReadableAccount + Sync> StorableAccounts<'a, T> for (Slot, &'a [(&'a
|
||||||
fn target_slot(&self) -> Slot {
|
fn target_slot(&self) -> Slot {
|
||||||
self.0
|
self.0
|
||||||
}
|
}
|
||||||
fn is_empty(&self) -> bool {
|
|
||||||
self.1.is_empty()
|
|
||||||
}
|
|
||||||
fn len(&self) -> usize {
|
fn len(&self) -> usize {
|
||||||
self.1.len()
|
self.1.len()
|
||||||
}
|
}
|
||||||
|
@ -66,9 +65,6 @@ impl<'a, T: ReadableAccount + Sync> StorableAccounts<'a, T>
|
||||||
fn target_slot(&self) -> Slot {
|
fn target_slot(&self) -> Slot {
|
||||||
self.0
|
self.0
|
||||||
}
|
}
|
||||||
fn is_empty(&self) -> bool {
|
|
||||||
self.1.is_empty()
|
|
||||||
}
|
|
||||||
fn len(&self) -> usize {
|
fn len(&self) -> usize {
|
||||||
self.1.len()
|
self.1.len()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue