Tempus Fugit
This is a Rust crate that operates around the concept of measuring the time it takes to take some action. Convenience is the name of the game here, and this end it enables a dependent crate to do 2 things:
-
Measuring the wall-clock time of any expression in nanosecond[1] resolution:
[] = "0.4"extern crate tempus_fugit; use File; use Read; use Measurement;The
measuremacro returns a tuple containing the result of executing an expression (in this case a block), as well as aMeasurementwhich indicates how long the expression took to execute. -
Displaying a
Measurementin a human-readable fashion. There is aDisplayimpl forMeasurement, so this is as easy as formatting a value with e.g.format!("{}", measurement).
[1] While the accounting is in nanosecond resolution, the actual resolution may be limited to courser granularity by the operating system.
In addition, the Measurement type has impls for Ord and Eq, which
makes comparison and ordering easy, as well as impls for de/serialization
through Serde.
Documentation
The API docs are located here.