Refactor SMFI interface and ectool

This commit is contained in:
Jeremy Soller
2020-09-25 19:41:38 -06:00
committed by Jeremy Soller
parent 39e2586c50
commit eff4caa752
19 changed files with 718 additions and 363 deletions

View File

@ -24,11 +24,16 @@ macro_rules! timeout {
}};
}
/// Timeout for use in blocking operations
pub trait Timeout {
/// Reset the timeout to its initial state
fn reset(&mut self);
/// Check if timeout is still running
fn running(&self) -> bool;
}
/// Timeout implemented using std::time
#[cfg(feature = "std")]
pub struct StdTimeout {
instant: Instant,
@ -37,6 +42,7 @@ pub struct StdTimeout {
#[cfg(feature = "std")]
impl StdTimeout {
/// Create a timeout with the specified duration
pub fn new(duration: Duration) -> Self {
StdTimeout {
instant: Instant::now(),