Skip to content

Commit

Permalink
SDK AccountKeys: make iter Clone-able
Browse files Browse the repository at this point in the history
  • Loading branch information
apfitzge committed Jun 17, 2024
1 parent f7dad6d commit cad7e83
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sdk/program/src/message/account_keys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ impl<'a> AccountKeys<'a> {
/// Returns an iterator of account key segments. The ordering of segments
/// affects how account indexes from compiled instructions are resolved and
/// so should not be changed.
fn key_segment_iter(&self) -> impl Iterator<Item = &'a [Pubkey]> {
fn key_segment_iter(&self) -> impl Iterator<Item = &'a [Pubkey]> + Clone {
if let Some(dynamic_keys) = self.dynamic_keys {
[
self.static_keys,
Expand Down Expand Up @@ -77,7 +77,7 @@ impl<'a> AccountKeys<'a> {
}

/// Iterator for the addresses of the loaded accounts for a message
pub fn iter(&self) -> impl Iterator<Item = &'a Pubkey> {
pub fn iter(&self) -> impl Iterator<Item = &'a Pubkey> + Clone {
self.key_segment_iter().flatten()
}

Expand Down

0 comments on commit cad7e83

Please sign in to comment.