Dynamic Timeout
Execute a function after a mutable duration.
use Duration;
use DynTimeout;
const TWENTY: Duration = from_millis;
let dyn_timeout = new;
dyn_timeout.add.unwrap;
// .sub...
// .cancel
This library was initially implemented to be used as a raft like election timeout.
Tokio version
This crate include a std with threads and a tokio implementation, usefull if you're already using this async library.
use Runtime;
use DynTimeout;
use Duration;
const TWENTY: Duration = from_millis;
let mut rt = new.unwrap;
rt.spawn;
Benchmark
Here is the bench with 40 milliseconds to wait with the standard implementation, under the nanoseconds the time precision decrease. (Using tokio decrease also the precision)
)
Contribute
- All increases of the time precision and code architecture are welcomes.
- Usage examples, documentation, typo and comments, unit tests.
- All interestings ideas are also good to know in an issue.
- Give your feedback, report errors and bugs in a github issue.
All development contribution, please, has to pass the currents unit tests and it's a must to include a new test!
License GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007
This lirary is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.