Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upTracking issue for Duration::span #27799
Comments
alexcrichton
added
T-libs
B-unstable
labels
Aug 13, 2015
This comment has been minimized.
This comment has been minimized.
|
Some previous discussion in rust-lang/rfcs#1243:
One thing is that the #[unstable(feature = "duration_span",
reason = "unsure if this is the right API or whether it should \
wait for a more general \"moment in time\" \
abstraction")]seems to suggest that |
This comment has been minimized.
This comment has been minimized.
|
I suggest either:
|
This comment has been minimized.
This comment has been minimized.
rustonaut
commented
Sep 18, 2015
|
I don't think It is documented as Runs a closure, returning the duration.. so maybe I also agree that it is kind of misplaced. The options provided by @SimonSapin do look good, through maybe a full Timer class is more suited for a small Library (witch also might have some more complex Timers, like hierarchical ones). |
This comment has been minimized.
This comment has been minimized.
|
Agreed on changing the This "full class" is really just an opaque data type to encapsulate a start timestamp. Maybe we can just expose |
This comment has been minimized.
This comment has been minimized.
Assigning to a closed-over variable is pretty ugly too, unfortunately. |
This comment has been minimized.
This comment has been minimized.
softprops
commented
Oct 31, 2015
|
If stablized, it may be useful to return a tuple of both the result of the closure run and the duration. let (value, duration) = Duration::span(thunk) |
This comment has been minimized.
This comment has been minimized.
softprops
commented
Oct 31, 2015
|
Alt name suggestion |
This comment has been minimized.
This comment has been minimized.
|
Nominating for 1.6 discussion |
alexcrichton
added
the
I-nominated
label
Nov 4, 2015
This comment has been minimized.
This comment has been minimized.
|
It's likely that rust-lang/rfcs#1288 will land during this cycle in which case using |
alexcrichton commentedAug 13, 2015
This is a tracking issue for the unstable
duration_spanfeature of the standard library. Known open questions are: