Skip to content

Commit

Permalink
NDEV-2329: impl Clone for Inner
Browse files Browse the repository at this point in the history
  • Loading branch information
andreisilviudragnea committed Nov 4, 2023
1 parent b6286a4 commit 06dff5e
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions evm_loader/program/src/evm/buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,18 +164,25 @@ impl Deref for Buffer {
impl Clone for Buffer {
#[inline]
fn clone(&self) -> Self {
match &self.inner {
Inner::Empty => Self::empty(),
Inner::Owned(allocation) => Self::new(Inner::Owned(allocation.clone())),
Inner::Account { key, data, range } => Self::new(Inner::Account {
Self::new(self.inner.clone())
}
}

impl Clone for Inner {
#[inline]
fn clone(&self) -> Self {
match &self {
Inner::Empty => Inner::Empty,
Inner::Owned(allocation) => Inner::Owned(allocation.clone()),
Inner::Account { key, data, range } => Inner::Account {
key: *key,
data: *data,
range: range.clone(),
}),
Inner::AccountUninit { key, range } => Self::new(Inner::AccountUninit {
},
Inner::AccountUninit { key, range } => Inner::AccountUninit {
key: *key,
range: range.clone(),
}),
},
}
}
}
Expand Down

0 comments on commit 06dff5e

Please sign in to comment.