Skip to content

Commit

Permalink
use Waker::clone_from internally
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelraz committed Nov 6, 2023
1 parent 112b40e commit da0c28c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/utils/wakers/array/readiness_array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ impl<const N: usize> ReadinessArray<N> {
/// Set the parent `Waker`. This needs to be called at the start of every
/// `poll` function.
pub(crate) fn set_waker(&mut self, parent_waker: &Waker) {
self.parent_waker = Some(parent_waker.clone());
match &mut self.parent_waker {
Some(prev) => prev.clone_from(parent_waker),
None => self.parent_waker = Some(parent_waker.clone()),
}
}
}
5 changes: 4 additions & 1 deletion src/utils/wakers/vec/readiness_vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,10 @@ impl ReadinessVec {
/// Set the parent `Waker`. This needs to be called at the start of every
/// `poll` function.
pub(crate) fn set_waker(&mut self, parent_waker: &Waker) {
self.parent_waker = Some(parent_waker.clone());
match &mut self.parent_waker {
Some(prev) => prev.clone_from(parent_waker),
None => self.parent_waker = Some(parent_waker.clone()),
}
}

/// Resize `readiness` to the new length.
Expand Down

0 comments on commit da0c28c

Please sign in to comment.