Skip to content

Commit

Permalink
Fix take impl on RuntimeFixedList
Browse files Browse the repository at this point in the history
  • Loading branch information
pawanjay176 committed Sep 4, 2024
1 parent 13f9bba commit e71020e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion consensus/types/src/runtime_var_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ pub struct RuntimeFixedList<T> {
len: usize,
}

impl<T: Clone> RuntimeFixedList<T> {
impl<T: Clone + Default> RuntimeFixedList<T> {
pub fn new(vec: Vec<T>) -> Self {
let len = vec.len();
Self { vec, len }
Expand All @@ -277,6 +277,7 @@ impl<T: Clone> RuntimeFixedList<T> {

pub fn take(&mut self) -> Self {
let new = std::mem::take(&mut self.vec);
*self = Self::new(vec![T::default(); self.len]);
Self {
vec: new,
len: self.len,
Expand Down

0 comments on commit e71020e

Please sign in to comment.