From 3888f77bafce82f417d60a86ffadb647e340fdc6 Mon Sep 17 00:00:00 2001 From: mox692 Date: Tue, 20 Feb 2024 01:16:20 +0900 Subject: [PATCH] Remove code snippet in note section --- tokio/src/task/task_local.rs | 26 -------------------------- 1 file changed, 26 deletions(-) diff --git a/tokio/src/task/task_local.rs b/tokio/src/task/task_local.rs index 0a735ac88a1..ba58ea6ae8b 100644 --- a/tokio/src/task/task_local.rs +++ b/tokio/src/task/task_local.rs @@ -343,36 +343,10 @@ where /// * `Some(T)` if the task local value exists. /// * `None` if the task local value has already been taken. /// - /// /// Note that this function attempts to take the task local value even if /// the future has not yet completed. In that case, the value will no longer /// be available via the task local after the call to `take_value`. /// - /// For example, the following code returns `Err` for accessing the `KEY` variable - /// in the async block of the `scope` function. - /// - /// ``` - /// # async fn dox() { - /// tokio::task_local! { - /// static KEY: u32; - /// } - /// - /// let fut = KEY.scope(42, async { - /// // Since `take_value()` has already been called at this point, - /// // `try_with` here will fail. - /// assert!(KEY.try_with(|_| {}).is_err()) - /// }); - /// - /// let mut pinned = Box::pin(fut); - /// - /// // With this call, the task local value of fut is unset. - /// assert_eq!(pinned.as_mut().take_value(), Some(42)); - /// - /// // Poll **after** invoking `take_value()` - /// let _ = pinned.as_mut().await; - /// # } - /// ``` - /// /// # Examples /// /// ```