During the write of an embedded library I needed to make a pause of 10 microseconds. Looking over the Nightly std::time::Duration documentation page I understood that I had to use the following construction:
// Wait 10 microseconds
thread::sleep(Duration::new(0, 10_000));
The sad part is that this is less clear to me than Duration::from_micros(10). Currently the from_millis and from_secs functions are implemented but not from_micros which could help write cleaner code IMO.
The fix seems pretty easy, maybe if you judge this useful I can try to write my first pull request to the Rust project!
During the write of an embedded library I needed to make a pause of 10 microseconds. Looking over the Nightly
std::time::Durationdocumentation page I understood that I had to use the following construction:The sad part is that this is less clear to me than
Duration::from_micros(10). Currently thefrom_millisandfrom_secsfunctions are implemented but notfrom_microswhich could help write cleaner code IMO.The fix seems pretty easy, maybe if you judge this useful I can try to write my first pull request to the Rust project!