Refactor SMFI interface and ectool
This commit is contained in:
committed by
Jeremy Soller
parent
39e2586c50
commit
eff4caa752
@ -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(),
|
||||
|
Reference in New Issue
Block a user