Skip to content

Commit

Permalink
make poll_join_next pub and add reset_after fns
Browse files Browse the repository at this point in the history
  • Loading branch information
DaughterOfMars committed Aug 15, 2024
1 parent 1d2869f commit 955d5fe
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion msim/src/sim/task/join_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ impl<T: 'static> JoinSet<T> {
std::mem::swap(&mut new_inner, &mut self.inner);
}

fn poll_join_next(&mut self, cx: &mut Context<'_>) -> Poll<Option<Result<T, JoinError>>> {
pub fn poll_join_next(&mut self, cx: &mut Context<'_>) -> Poll<Option<Result<T, JoinError>>> {
let pinned = Pin::new(&mut self.inner);
pinned.poll_next(cx)
}
Expand Down
7 changes: 7 additions & 0 deletions msim/src/sim/time/interval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,13 @@ impl Interval {
self.delay.as_mut().reset(Instant::now() + self.period);
}

/// Resets the interval after the specified [`std::time::Duration`]
///
/// This method ignores [`MissedTickBehavior`] strategy.
pub fn reset_after(&mut self, after: Duration) {
self.delay.as_mut().reset(Instant::now() + after);
}

/// Returns the [`MissedTickBehavior`] strategy currently being used.
pub fn missed_tick_behavior(&self) -> MissedTickBehavior {
self.missed_tick_behavior
Expand Down

0 comments on commit 955d5fe

Please sign in to comment.