mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-09-02 00:00:11 +02:00
tokio-reactor: deprecates Handle::current() (#805)
The side effects of calling `Handle::current()` from outside of a runtime could be very surprising, since it would start up a background reactor.
This commit is contained in:
@@ -455,7 +455,8 @@ impl fmt::Debug for Reactor {
|
|||||||
// ===== impl Handle =====
|
// ===== impl Handle =====
|
||||||
|
|
||||||
impl Handle {
|
impl Handle {
|
||||||
/// Returns a handle to the current reactor.
|
#[doc(hidden)]
|
||||||
|
#[deprecated(note = "semantics were sometimes surprising, use Handle::default()")]
|
||||||
pub fn current() -> Handle {
|
pub fn current() -> Handle {
|
||||||
// TODO: Should this panic on error?
|
// TODO: Should this panic on error?
|
||||||
HandlePriv::try_current()
|
HandlePriv::try_current()
|
||||||
|
|||||||
Reference in New Issue
Block a user