time: Deprecate the library in the distribution#18858
Conversation
|
cc #18585, one less crate to worry about! |
There was a problem hiding this comment.
I wouldn't want to block this PR on this but I think it'd be better for span to take a closure that returns T and return a tuple of (Duration, T) to make it more general-purpose. It'd certainly make it easier to avoid the extra mutable variables that are introduced at this function's call sites in this PR.
There was a problem hiding this comment.
Yeah that would definitely help out those use cases, but I figured that it would be slightly odd to have to worry about the tuple afterwards. I think it may be the right way to go though, it seemed to come up more often than I anticipated!
|
As you're saying we'll tweak the interface with unboxed closures anyway, at which point we can make the suggested change. |
5ed19a0 to
4f63687
Compare
4f63687 to
a90f44c
Compare
This commit deprecates the entire libtime library in favor of the
externally-provided libtime in the rust-lang organization. Users of the
`libtime` crate as-is today should add this to their Cargo manifests:
[dependencies.time]
git = "https://github.com/rust-lang/time"
To implement this transition, a new function `Duration::span` was added to the
`std::time::Duration` time. This function takes a closure and then returns the
duration of time it took that closure to execute. This interface will likely
improve with `FnOnce` unboxed closures as moving in and out will be a little
easier.
Due to the deprecation of the in-tree crate, this is a:
[breaking-change]
cc rust-lang#18855, some of the conversions in the `src/test/bench` area may have been a
little nicer with that implemented
a90f44c to
fcd05ed
Compare
This commit deprecates the entire libtime library in favor of the
externally-provided libtime in the rust-lang organization. Users of the
`libtime` crate as-is today should add this to their Cargo manifests:
[dependencies.time]
git = "https://github.com/rust-lang/time"
To implement this transition, a new function `Duration::span` was added to the
`std::time::Duration` time. This function takes a closure and then returns the
duration of time it took that closure to execute. This interface will likely
improve with `FnOnce` unboxed closures as moving in and out will be a little
easier.
Due to the deprecation of the in-tree crate, this is a:
[breaking-change]
cc #18855, some of the conversions in the `src/test/bench` area may have been a
little nicer with that implemented
…8854 fix: clear diagnostics on cancel unconditionally
This commit deprecates the entire libtime library in favor of the
externally-provided libtime in the rust-lang organization. Users of the
libtimecrate as-is today should add this to their Cargo manifests:To implement this transition, a new function
Duration::spanwas added to thestd::time::Durationtime. This function takes a closure and then returns theduration of time it took that closure to execute. This interface will likely
improve with
FnOnceunboxed closures as moving in and out will be a littleeasier.
Due to the deprecation of the in-tree crate, this is a:
[breaking-change]
cc #18855, some of the conversions in the
src/test/bencharea may have been alittle nicer with that implemented