id
stringlengths
22
133
text
stringlengths
40
40.2k
arch
stringclasses
1 value
syntax
stringclasses
1 value
kind
stringclasses
4 values
repo
stringclasses
27 values
path
stringlengths
5
116
license
stringclasses
6 values
commit
stringlengths
40
40
source_host
stringclasses
1 value
category
stringclasses
16 values
source_url
stringlengths
85
196
line_start
int64
1
4.28k
line_end
int64
4
4.31k
tokio-rs/tokio:tokio/src/runtime/handle.rs:8
} /// Returns the flavor of the current `Runtime`. /// /// # Examples /// /// ``` /// use tokio::runtime::{Handle, RuntimeFlavor}; /// /// #[tokio::main(flavor = "current_thread")] /// async fn main() { /// assert_eq!(RuntimeFlavor::CurrentThread, Handle::current().runtime_fla...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
b1f40f4356c7f7be0e1959f992608d2058a76deb
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b1f40f4356c7f7be0e1959f992608d2058a76deb/tokio/src/runtime/handle.rs
281
340
tokio-rs/tokio:tokio/src/runtime/handle.rs:9
} } } /// Error returned by `try_current` when no Runtime has been started #[derive(Debug)] pub struct TryCurrentError { kind: TryCurrentErrorKind, } impl TryCurrentError { pub(crate) fn new_no_context() -> Self { Self { kind: TryCurrentErrorKind::NoContext, } } pub(cr...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
b1f40f4356c7f7be0e1959f992608d2058a76deb
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b1f40f4356c7f7be0e1959f992608d2058a76deb/tokio/src/runtime/handle.rs
321
380
tokio-rs/tokio:tokio/src/runtime/handle.rs:10
} impl fmt::Debug for TryCurrentErrorKind { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { use TryCurrentErrorKind::*; match self { NoContext => f.write_str("NoContext"), ThreadLocalDestroyed => f.write_str("ThreadLocalDestroyed"), } } } impl fmt::Di...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
b1f40f4356c7f7be0e1959f992608d2058a76deb
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b1f40f4356c7f7be0e1959f992608d2058a76deb/tokio/src/runtime/handle.rs
361
383
tokio-rs/tokio:tokio/src/runtime/handle.rs:1
use crate::runtime::{context, scheduler, RuntimeFlavor}; /// Handle to the runtime. /// /// The handle is internally reference-counted and can be freely cloned. A handle can be /// obtained using the [`Runtime::handle`] method. /// /// [`Runtime::handle`]: crate::runtime::Runtime::handle() #[derive(Debug, Clone)] // W...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
df99428c17ff03134d8f081ee80ef0f6fbe3c813
github
async-runtime
https://github.com/tokio-rs/tokio/blob/df99428c17ff03134d8f081ee80ef0f6fbe3c813/tokio/src/runtime/handle.rs
1
60
tokio-rs/tokio:tokio/src/runtime/handle.rs:4
/// /// See [module level][mod] documentation for more details. /// /// [mod]: index.html /// /// # Examples /// /// ``` /// use tokio::runtime::Runtime; /// /// # fn dox() { /// // Create the runtime /// let rt = Runtime::new().unwrap(); /// // Get a handle from this...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
df99428c17ff03134d8f081ee80ef0f6fbe3c813
github
async-runtime
https://github.com/tokio-rs/tokio/blob/df99428c17ff03134d8f081ee80ef0f6fbe3c813/tokio/src/runtime/handle.rs
121
180
tokio-rs/tokio:tokio/src/runtime/handle.rs:7
/// [`JoinError`]: struct@crate::task::JoinError /// [`JoinHandle`]: struct@crate::task::JoinHandle /// [`Runtime::block_on`]: fn@crate::runtime::Runtime::block_on /// [`Runtime::shutdown_background`]: fn@crate::runtime::Runtime::shutdown_background /// [`Runtime::shutdown_timeout`]: fn@crate::runtime::...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
df99428c17ff03134d8f081ee80ef0f6fbe3c813
github
async-runtime
https://github.com/tokio-rs/tokio/blob/df99428c17ff03134d8f081ee80ef0f6fbe3c813/tokio/src/runtime/handle.rs
241
300
tokio-rs/tokio:tokio/src/runtime/handle.rs:8
/// /// # Examples /// /// ``` /// use tokio::runtime::{Handle, RuntimeFlavor}; /// /// #[tokio::main(flavor = "current_thread")] /// async fn main() { /// assert_eq!(RuntimeFlavor::CurrentThread, Handle::current().runtime_flavor()); /// } /// ``` /// /// ``` /// us...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
df99428c17ff03134d8f081ee80ef0f6fbe3c813
github
async-runtime
https://github.com/tokio-rs/tokio/blob/df99428c17ff03134d8f081ee80ef0f6fbe3c813/tokio/src/runtime/handle.rs
281
340
tokio-rs/tokio:tokio/src/runtime/handle.rs:10
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { use TryCurrentErrorKind::*; match self { NoContext => f.write_str("NoContext"), ThreadLocalDestroyed => f.write_str("ThreadLocalDestroyed"), } } } impl fmt::Display for TryCurrentError { fn fmt(&self, f: ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
df99428c17ff03134d8f081ee80ef0f6fbe3c813
github
async-runtime
https://github.com/tokio-rs/tokio/blob/df99428c17ff03134d8f081ee80ef0f6fbe3c813/tokio/src/runtime/handle.rs
361
380
tokio-rs/tokio:tokio/src/runtime/handle.rs:1
use crate::runtime::{scheduler, RuntimeFlavor}; /// Handle to the runtime. /// /// The handle is internally reference-counted and can be freely cloned. A handle can be /// obtained using the [`Runtime::handle`] method. /// /// [`Runtime::handle`]: crate::runtime::Runtime::handle() #[derive(Debug, Clone)] // When the `...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
fe1843c0e02473564ad3adc90b2c033d7c363df1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/fe1843c0e02473564ad3adc90b2c033d7c363df1/tokio/src/runtime/handle.rs
1
60
tokio-rs/tokio:tokio/src/runtime/handle.rs:1
use crate::runtime::scheduler; /// Handle to the runtime. /// /// The handle is internally reference-counted and can be freely cloned. A handle can be /// obtained using the [`Runtime::handle`] method. /// /// [`Runtime::handle`]: crate::runtime::Runtime::handle() #[derive(Debug, Clone)] // When the `rt` feature is *n...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
2f244514346a37bf598d8fc1c593d68771eb6047
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2f244514346a37bf598d8fc1c593d68771eb6047/tokio/src/runtime/handle.rs
1
60
tokio-rs/tokio:tokio/src/runtime/handle.rs:7
/// [`JoinError`]: struct@crate::task::JoinError /// [`JoinHandle`]: struct@crate::task::JoinHandle /// [`Runtime::block_on`]: fn@crate::runtime::Runtime::block_on /// [`Runtime::shutdown_background`]: fn@crate::runtime::Runtime::shutdown_background /// [`Runtime::shutdown_timeout`]: fn@crate::runtime::...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
2f244514346a37bf598d8fc1c593d68771eb6047
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2f244514346a37bf598d8fc1c593d68771eb6047/tokio/src/runtime/handle.rs
241
300
tokio-rs/tokio:tokio/src/runtime/handle.rs:8
cfg_metrics! { use crate::runtime::RuntimeMetrics; impl Handle { /// Returns a view that lets you get information about how the runtime /// is performing. pub fn metrics(&self) -> RuntimeMetrics { RuntimeMetrics::new(self.clone()) } } } /// Error returned by `tr...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
2f244514346a37bf598d8fc1c593d68771eb6047
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2f244514346a37bf598d8fc1c593d68771eb6047/tokio/src/runtime/handle.rs
281
340
tokio-rs/tokio:tokio/src/runtime/handle.rs:1
use crate::runtime::scheduler; /// Handle to the runtime. /// /// The handle is internally reference-counted and can be freely cloned. A handle can be /// obtained using the [`Runtime::handle`] method. /// /// [`Runtime::handle`]: crate::runtime::Runtime::handle() #[derive(Debug, Clone)] // When the `rt` feature is *n...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
cb67f28fe3c99956959669277fde889bc2dc252e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/cb67f28fe3c99956959669277fde889bc2dc252e/tokio/src/runtime/handle.rs
1
60
tokio-rs/tokio:tokio/src/runtime/handle.rs:4
/// immediately when `spawn` is called. /// /// See [module level][mod] documentation for more details. /// /// [mod]: index.html /// /// # Examples /// /// ``` /// use tokio::runtime::Runtime; /// /// # fn dox() { /// // Create the runtime /// let rt = Runtime::new()...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
cb67f28fe3c99956959669277fde889bc2dc252e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/cb67f28fe3c99956959669277fde889bc2dc252e/tokio/src/runtime/handle.rs
121
180
tokio-rs/tokio:tokio/src/runtime/handle.rs:7
/// /// [`JoinError`]: struct@crate::task::JoinError /// [`JoinHandle`]: struct@crate::task::JoinHandle /// [`Runtime::block_on`]: fn@crate::runtime::Runtime::block_on /// [`Runtime::shutdown_background`]: fn@crate::runtime::Runtime::shutdown_background /// [`Runtime::shutdown_timeout`]: fn@crate::r...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
cb67f28fe3c99956959669277fde889bc2dc252e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/cb67f28fe3c99956959669277fde889bc2dc252e/tokio/src/runtime/handle.rs
241
300
tokio-rs/tokio:tokio/src/runtime/handle.rs:9
/// other thread-locals. pub fn is_thread_local_destroyed(&self) -> bool { matches!(self.kind, TryCurrentErrorKind::ThreadLocalDestroyed) } } enum TryCurrentErrorKind { NoContext, ThreadLocalDestroyed, } impl fmt::Debug for TryCurrentErrorKind { fn fmt(&self, f: &mut fmt::Formatter<'_>) ->...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
cb67f28fe3c99956959669277fde889bc2dc252e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/cb67f28fe3c99956959669277fde889bc2dc252e/tokio/src/runtime/handle.rs
321
352
tokio-rs/tokio:tokio/src/runtime/handle.rs:4
/// See [module level][mod] documentation for more details. /// /// [mod]: index.html /// /// # Examples /// /// ``` /// use tokio::runtime::Runtime; /// /// # fn dox() { /// // Create the runtime /// let rt = Runtime::new().unwrap(); /// // Get a handle from this runtime...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
b248be2879dfc5e19d1b82561486efede74172ba
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b248be2879dfc5e19d1b82561486efede74172ba/tokio/src/runtime/handle.rs
121
180
tokio-rs/tokio:tokio/src/runtime/handle.rs:7
/// [`JoinHandle`]: struct@crate::task::JoinHandle /// [`Runtime::block_on`]: fn@crate::runtime::Runtime::block_on /// [`Runtime::shutdown_background`]: fn@crate::runtime::Runtime::shutdown_background /// [`Runtime::shutdown_timeout`]: fn@crate::runtime::Runtime::shutdown_timeout /// [`spawn_blocking`]:...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
b248be2879dfc5e19d1b82561486efede74172ba
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b248be2879dfc5e19d1b82561486efede74172ba/tokio/src/runtime/handle.rs
241
300
tokio-rs/tokio:tokio/src/runtime/handle.rs:8
use crate::runtime::RuntimeMetrics; impl Handle { /// Returns a view that lets you get information about how the runtime /// is performing. pub fn metrics(&self) -> RuntimeMetrics { RuntimeMetrics::new(self.clone()) } } } /// Error returned by `try_current` when no ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
b248be2879dfc5e19d1b82561486efede74172ba
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b248be2879dfc5e19d1b82561486efede74172ba/tokio/src/runtime/handle.rs
281
340
tokio-rs/tokio:tokio/src/runtime/handle.rs:9
matches!(self.kind, TryCurrentErrorKind::ThreadLocalDestroyed) } } enum TryCurrentErrorKind { NoContext, ThreadLocalDestroyed, } impl fmt::Debug for TryCurrentErrorKind { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { use TryCurrentErrorKind::*; match self { NoC...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
b248be2879dfc5e19d1b82561486efede74172ba
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b248be2879dfc5e19d1b82561486efede74172ba/tokio/src/runtime/handle.rs
321
350
tokio-rs/tokio:tokio/src/runtime/handle.rs:4
/// # Examples /// /// ``` /// use tokio::runtime::Runtime; /// /// # fn dox() { /// // Create the runtime /// let rt = Runtime::new().unwrap(); /// // Get a handle from this runtime /// let handle = rt.handle(); /// /// // Spawn a future onto the runtime using the handle ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
ebeb78ed40027032feb77c89a1de4b58d2dcafbf
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ebeb78ed40027032feb77c89a1de4b58d2dcafbf/tokio/src/runtime/handle.rs
121
180
tokio-rs/tokio:tokio/src/runtime/handle.rs:7
/// [`spawn_blocking`]: crate::task::spawn_blocking /// [`tokio::fs`]: crate::fs /// [`tokio::net`]: crate::net /// [`tokio::time`]: crate::time #[track_caller] pub fn block_on<F: Future>(&self, future: F) -> F::Output { #[cfg(all(tokio_unstable, feature = "tracing"))] let future = ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
ebeb78ed40027032feb77c89a1de4b58d2dcafbf
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ebeb78ed40027032feb77c89a1de4b58d2dcafbf/tokio/src/runtime/handle.rs
241
300
tokio-rs/tokio:tokio/src/runtime/handle.rs:8
/// is performing. pub fn metrics(&self) -> RuntimeMetrics { RuntimeMetrics::new(self.clone()) } } } /// Error returned by `try_current` when no Runtime has been started #[derive(Debug)] pub struct TryCurrentError { kind: TryCurrentErrorKind, } impl TryCurrentError { pub(crate)...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
ebeb78ed40027032feb77c89a1de4b58d2dcafbf
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ebeb78ed40027032feb77c89a1de4b58d2dcafbf/tokio/src/runtime/handle.rs
281
340
tokio-rs/tokio:tokio/src/runtime/handle.rs:1
// When the runtime refactor is done, this should be removed. #![cfg_attr(not(feature = "rt"), allow(dead_code))] use crate::runtime::driver; #[cfg(feature = "rt")] use crate::util::RngSeedGenerator; use std::sync::Arc; /// Handle to the runtime. /// /// The handle is internally reference-counted and can be freely ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
b5709baa917494043e21589adb10347c57361f1f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b5709baa917494043e21589adb10347c57361f1f/tokio/src/runtime/handle.rs
1
60
tokio-rs/tokio:tokio/src/runtime/handle.rs:2
pub(super) seed_generator: RngSeedGenerator, } cfg_rt! { use crate::runtime::task::JoinHandle; use crate::runtime::{blocking, context, Spawner}; use crate::util::error::{CONTEXT_MISSING_ERROR, THREAD_LOCAL_DESTROYED_ERROR}; use std::future::Future; use std::marker::PhantomData; use std::{error...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
b5709baa917494043e21589adb10347c57361f1f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b5709baa917494043e21589adb10347c57361f1f/tokio/src/runtime/handle.rs
41
100
tokio-rs/tokio:tokio/src/runtime/handle.rs:4
/// }); /// # handle.join().unwrap(); /// # }); /// # } /// ``` #[track_caller] pub fn current() -> Self { context::current() } /// Returns a Handle view over the currently running Runtime /// /// Returns an error if no Runtime...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
b5709baa917494043e21589adb10347c57361f1f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b5709baa917494043e21589adb10347c57361f1f/tokio/src/runtime/handle.rs
121
180
tokio-rs/tokio:tokio/src/runtime/handle.rs:5
/// // Spawn a future onto the runtime using the handle /// handle.spawn(async { /// println!("now running on a worker thread"); /// }); /// # } /// ``` #[track_caller] pub fn spawn<F>(&self, future: F) -> JoinHandle<F::Output> where F: Fut...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
b5709baa917494043e21589adb10347c57361f1f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b5709baa917494043e21589adb10347c57361f1f/tokio/src/runtime/handle.rs
161
220
tokio-rs/tokio:tokio/src/runtime/handle.rs:7
/// let rt = Runtime::new().unwrap(); /// /// // Get a handle from this runtime /// let handle = rt.handle(); /// /// // Execute the future, blocking the current thread until completion /// handle.block_on(async { /// println!("hello"); /// }); ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
b5709baa917494043e21589adb10347c57361f1f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b5709baa917494043e21589adb10347c57361f1f/tokio/src/runtime/handle.rs
241
300
tokio-rs/tokio:tokio/src/runtime/handle.rs:8
let future = crate::util::trace::task(future, "block_on", None, super::task::Id::next().as_u64()); // Enter the **runtime** context. This configures spawning, the current I/O driver, ... let _rt_enter = self.enter(); // Enter a **blocking** context. This prevents bl...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
b5709baa917494043e21589adb10347c57361f1f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b5709baa917494043e21589adb10347c57361f1f/tokio/src/runtime/handle.rs
281
340
tokio-rs/tokio:tokio/src/runtime/handle.rs:10
} impl fmt::Debug for TryCurrentErrorKind { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { use TryCurrentErrorKind::*; match self { NoContext => f.write_str("NoContext"), ThreadLocalDestroyed => f.write_str("ThreadLocalDestroyed"), ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
b5709baa917494043e21589adb10347c57361f1f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b5709baa917494043e21589adb10347c57361f1f/tokio/src/runtime/handle.rs
361
402
tokio-rs/tokio:tokio/src/runtime/handle.rs:1
// When the runtime refactor is done, this should be removed. #![cfg_attr(not(feature = "rt"), allow(dead_code))] use crate::runtime::driver; use std::sync::Arc; /// Handle to the runtime. /// /// The handle is internally reference-counted and can be freely cloned. A handle can be /// obtained using the [`Runtime::h...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
9e0275977981356fc5618b2061cdac8eb39a9569
github
async-runtime
https://github.com/tokio-rs/tokio/blob/9e0275977981356fc5618b2061cdac8eb39a9569/tokio/src/runtime/handle.rs
1
60
tokio-rs/tokio:tokio/src/runtime/handle.rs:2
use std::future::Future; use std::marker::PhantomData; use std::{error, fmt}; /// Runtime context guard. /// /// Returned by [`Runtime::enter`] and [`Handle::enter`], the context guard exits /// the runtime context on drop. /// /// [`Runtime::enter`]: fn@crate::runtime::Runtime::enter ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
9e0275977981356fc5618b2061cdac8eb39a9569
github
async-runtime
https://github.com/tokio-rs/tokio/blob/9e0275977981356fc5618b2061cdac8eb39a9569/tokio/src/runtime/handle.rs
41
100
tokio-rs/tokio:tokio/src/runtime/handle.rs:5
pub fn spawn<F>(&self, future: F) -> JoinHandle<F::Output> where F: Future + Send + 'static, F::Output: Send + 'static, { self.spawn_named(future, None) } /// Runs the provided function on an executor dedicated to blocking. /// operations. ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
9e0275977981356fc5618b2061cdac8eb39a9569
github
async-runtime
https://github.com/tokio-rs/tokio/blob/9e0275977981356fc5618b2061cdac8eb39a9569/tokio/src/runtime/handle.rs
161
220
tokio-rs/tokio:tokio/src/runtime/handle.rs:7
/// println!("hello"); /// }); /// ``` /// /// Or using `Handle::current`: /// /// ``` /// use tokio::runtime::Handle; /// /// #[tokio::main] /// async fn main () { /// let handle = Handle::current(); /// std::th...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
9e0275977981356fc5618b2061cdac8eb39a9569
github
async-runtime
https://github.com/tokio-rs/tokio/blob/9e0275977981356fc5618b2061cdac8eb39a9569/tokio/src/runtime/handle.rs
241
300
tokio-rs/tokio:tokio/src/runtime/handle.rs:8
let mut blocking_enter = crate::runtime::enter(true); // Block on the future blocking_enter .block_on(future) .expect("failed to park thread") } #[track_caller] pub(crate) fn spawn_named<F>(&self, future: F, _name: Option<&str>) -> JoinHa...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
9e0275977981356fc5618b2061cdac8eb39a9569
github
async-runtime
https://github.com/tokio-rs/tokio/blob/9e0275977981356fc5618b2061cdac8eb39a9569/tokio/src/runtime/handle.rs
281
340
tokio-rs/tokio:tokio/src/runtime/handle.rs:9
kind: TryCurrentErrorKind, } impl TryCurrentError { pub(crate) fn new_no_context() -> Self { Self { kind: TryCurrentErrorKind::NoContext, } } pub(crate) fn new_thread_local_destroyed() -> Self { Self { kind: TryCurrent...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
9e0275977981356fc5618b2061cdac8eb39a9569
github
async-runtime
https://github.com/tokio-rs/tokio/blob/9e0275977981356fc5618b2061cdac8eb39a9569/tokio/src/runtime/handle.rs
321
380
tokio-rs/tokio:tokio/src/runtime/handle.rs:10
ThreadLocalDestroyed => f.write_str("ThreadLocalDestroyed"), } } } impl fmt::Display for TryCurrentError { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { use TryCurrentErrorKind::*; match self.kind { NoContext => f.write_str(CONTEX...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
9e0275977981356fc5618b2061cdac8eb39a9569
github
async-runtime
https://github.com/tokio-rs/tokio/blob/9e0275977981356fc5618b2061cdac8eb39a9569/tokio/src/runtime/handle.rs
361
395
tokio-rs/tokio:tokio/src/runtime/handle.rs:1
// When the runtime refactor is done, this should be removed. #![cfg_attr(not(feature = "rt"), allow(dead_code))] use crate::runtime::driver; use std::sync::Arc; /// Handle to the runtime. /// /// The handle is internally reference-counted and can be freely cloned. A handle can be /// obtained using the [`Runtime::h...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
588408c06000313f7b4f31c225d3635e9b012e3f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/588408c06000313f7b4f31c225d3635e9b012e3f/tokio/src/runtime/handle.rs
1
60
tokio-rs/tokio:tokio/src/runtime/handle.rs:2
any( loom, not(all(unix, feature = "signal")), not(all(unix, feature = "process")), ), allow(dead_code) )] pub(super) signal_handle: driver::SignalHandle, /// Handles to the time drivers #[cfg_attr(not(feature = "time"), allow(dead_code))] pub(sup...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
588408c06000313f7b4f31c225d3635e9b012e3f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/588408c06000313f7b4f31c225d3635e9b012e3f/tokio/src/runtime/handle.rs
41
100
tokio-rs/tokio:tokio/src/runtime/handle.rs:5
/// This spawns the given future onto the runtime's executor, usually a /// thread pool. The thread pool is then responsible for polling the future /// until it completes. /// /// See [module level][mod] documentation for more details. /// /// [mod]: index.html //...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
588408c06000313f7b4f31c225d3635e9b012e3f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/588408c06000313f7b4f31c225d3635e9b012e3f/tokio/src/runtime/handle.rs
161
220
tokio-rs/tokio:tokio/src/runtime/handle.rs:8
/// handle.block_on(async { /// println!("hello"); /// }); /// }); /// } /// ``` /// /// [`JoinError`]: struct@crate::task::JoinError /// [`JoinHandle`]: struct@crate::task::JoinHandle /// [`Runtime::block_on`]: fn@c...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
588408c06000313f7b4f31c225d3635e9b012e3f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/588408c06000313f7b4f31c225d3635e9b012e3f/tokio/src/runtime/handle.rs
281
340
tokio-rs/tokio:tokio/src/runtime/handle.rs:9
let id = crate::runtime::task::Id::next(); #[cfg(all(tokio_unstable, feature = "tracing"))] let future = crate::util::trace::task(future, "task", _name, id.as_u64()); self.inner.spawner.spawn(future, id) } pub(crate) fn shutdown(&self) { self.inner.spawne...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
588408c06000313f7b4f31c225d3635e9b012e3f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/588408c06000313f7b4f31c225d3635e9b012e3f/tokio/src/runtime/handle.rs
321
380
tokio-rs/tokio:tokio/src/runtime/handle.rs:10
} /// Returns true if the call failed because there is currently no runtime in /// the Tokio context. pub fn is_missing_context(&self) -> bool { matches!(self.kind, TryCurrentErrorKind::NoContext) } /// Returns true if the call failed because the Tokio context threa...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
588408c06000313f7b4f31c225d3635e9b012e3f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/588408c06000313f7b4f31c225d3635e9b012e3f/tokio/src/runtime/handle.rs
361
420
tokio-rs/tokio:tokio/src/runtime/handle.rs:11
impl error::Error for TryCurrentError {} } cfg_not_rt! { impl Handle { pub(crate) fn current() -> Handle { panic!("{}", crate::util::error::CONTEXT_MISSING_ERROR) } } } cfg_time! { impl Handle { #[track_caller] pub(crate) fn as_time_handle(&self) -> &crate::runt...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
588408c06000313f7b4f31c225d3635e9b012e3f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/588408c06000313f7b4f31c225d3635e9b012e3f/tokio/src/runtime/handle.rs
401
421
tokio-rs/tokio:tokio/src/runtime/handle.rs:1
use crate::runtime::task::JoinHandle; use crate::runtime::{blocking, context, driver, Spawner}; use crate::util::error::{CONTEXT_MISSING_ERROR, THREAD_LOCAL_DESTROYED_ERROR}; use std::future::Future; use std::marker::PhantomData; use std::sync::Arc; use std::{error, fmt}; /// Handle to the runtime. /// /// The handle...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
56ffea09e5ab682e49eab0374da651f277e72566
github
async-runtime
https://github.com/tokio-rs/tokio/blob/56ffea09e5ab682e49eab0374da651f277e72566/tokio/src/runtime/handle.rs
1
60
tokio-rs/tokio:tokio/src/runtime/handle.rs:2
not(all(unix, feature = "signal")), not(all(unix, feature = "process")), ), allow(dead_code) )] pub(super) signal_handle: driver::SignalHandle, /// Handles to the time drivers #[cfg_attr(not(feature = "time"), allow(dead_code))] pub(super) time_handle: driver::TimeHandle...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
56ffea09e5ab682e49eab0374da651f277e72566
github
async-runtime
https://github.com/tokio-rs/tokio/blob/56ffea09e5ab682e49eab0374da651f277e72566/tokio/src/runtime/handle.rs
41
100
tokio-rs/tokio:tokio/src/runtime/handle.rs:4
/// // This next line would cause a panic because we haven't entered the runtime /// // and created an EnterGuard /// // let handle2 = Handle::current(); // panic /// // So we create a guard here with Handle::enter(); /// let _guard = handle.enter(); /// // Now we can call Ha...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
56ffea09e5ab682e49eab0374da651f277e72566
github
async-runtime
https://github.com/tokio-rs/tokio/blob/56ffea09e5ab682e49eab0374da651f277e72566/tokio/src/runtime/handle.rs
121
180
tokio-rs/tokio:tokio/src/runtime/handle.rs:5
/// /// # fn dox() { /// // Create the runtime /// let rt = Runtime::new().unwrap(); /// // Get a handle from this runtime /// let handle = rt.handle(); /// /// // Spawn a future onto the runtime using the handle /// handle.spawn(async { /// println!("now running on a worker thre...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
56ffea09e5ab682e49eab0374da651f277e72566
github
async-runtime
https://github.com/tokio-rs/tokio/blob/56ffea09e5ab682e49eab0374da651f277e72566/tokio/src/runtime/handle.rs
161
220
tokio-rs/tokio:tokio/src/runtime/handle.rs:8
/// [`spawn_blocking`]: crate::task::spawn_blocking /// [`tokio::fs`]: crate::fs /// [`tokio::net`]: crate::net /// [`tokio::time`]: crate::time #[track_caller] pub fn block_on<F: Future>(&self, future: F) -> F::Output { #[cfg(all(tokio_unstable, feature = "tracing"))] let future = ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
56ffea09e5ab682e49eab0374da651f277e72566
github
async-runtime
https://github.com/tokio-rs/tokio/blob/56ffea09e5ab682e49eab0374da651f277e72566/tokio/src/runtime/handle.rs
281
340
tokio-rs/tokio:tokio/src/runtime/handle.rs:1
use crate::runtime::task::JoinHandle; use crate::runtime::{blocking, context, driver, Spawner}; use crate::util::error::{CONTEXT_MISSING_ERROR, THREAD_LOCAL_DESTROYED_ERROR}; use std::future::Future; use std::marker::PhantomData; use std::{error, fmt}; /// Handle to the runtime. /// /// The handle is internally refer...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
3a4f18b93b674a30771a4a0c023a65b099fa0920
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3a4f18b93b674a30771a4a0c023a65b099fa0920/tokio/src/runtime/handle.rs
1
60
tokio-rs/tokio:tokio/src/runtime/handle.rs:2
allow(dead_code) )] pub(super) signal_handle: driver::SignalHandle, /// Handles to the time drivers #[cfg_attr(not(feature = "time"), allow(dead_code))] pub(super) time_handle: driver::TimeHandle, /// Source of `Instant::now()` #[cfg_attr(not(all(feature = "time", feature = "test-util")), ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
3a4f18b93b674a30771a4a0c023a65b099fa0920
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3a4f18b93b674a30771a4a0c023a65b099fa0920/tokio/src/runtime/handle.rs
41
100
tokio-rs/tokio:tokio/src/runtime/handle.rs:4
/// // So we create a guard here with Handle::enter(); /// let _guard = handle.enter(); /// // Now we can call Handle::current(); /// let handle2 = Handle::current(); /// }); /// # handle.join().unwrap(); /// # }); /// # } /// ``` #[track_caller] pub fn current() ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
3a4f18b93b674a30771a4a0c023a65b099fa0920
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3a4f18b93b674a30771a4a0c023a65b099fa0920/tokio/src/runtime/handle.rs
121
180
tokio-rs/tokio:tokio/src/runtime/handle.rs:5
/// let rt = Runtime::new().unwrap(); /// // Get a handle from this runtime /// let handle = rt.handle(); /// /// // Spawn a future onto the runtime using the handle /// handle.spawn(async { /// println!("now running on a worker thread"); /// }); /// # } /// ``` #[track_calle...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
3a4f18b93b674a30771a4a0c023a65b099fa0920
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3a4f18b93b674a30771a4a0c023a65b099fa0920/tokio/src/runtime/handle.rs
161
220
tokio-rs/tokio:tokio/src/runtime/handle.rs:8
/// [`tokio::time`]: crate::time #[track_caller] pub fn block_on<F: Future>(&self, future: F) -> F::Output { #[cfg(all(tokio_unstable, feature = "tracing"))] let future = crate::util::trace::task(future, "block_on", None, super::task::Id::next().as_u64()); // Enter the **run...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
3a4f18b93b674a30771a4a0c023a65b099fa0920
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3a4f18b93b674a30771a4a0c023a65b099fa0920/tokio/src/runtime/handle.rs
281
340
tokio-rs/tokio:tokio/src/runtime/handle.rs:9
/// Returns a view that lets you get information about how the runtime /// is performing. pub fn metrics(&self) -> RuntimeMetrics { RuntimeMetrics::new(self.clone()) } } } /// Error returned by `try_current` when no Runtime has been started #[derive(Debug)] pub struct TryCurrent...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
3a4f18b93b674a30771a4a0c023a65b099fa0920
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3a4f18b93b674a30771a4a0c023a65b099fa0920/tokio/src/runtime/handle.rs
321
380
tokio-rs/tokio:tokio/src/runtime/handle.rs:1
use crate::runtime::task::JoinHandle; use crate::runtime::{blocking, context, driver, Spawner}; use crate::util::error::{CONTEXT_MISSING_ERROR, THREAD_LOCAL_DESTROYED_ERROR}; use std::future::Future; use std::marker::PhantomData; use std::{error, fmt}; /// Handle to the runtime. /// /// The handle is internally refer...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
d7b3b33c9c95935c4eba70293d75a870a5d5ba24
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d7b3b33c9c95935c4eba70293d75a870a5d5ba24/tokio/src/runtime/handle.rs
1
60
tokio-rs/tokio:tokio/src/runtime/handle.rs:2
allow(dead_code) )] pub(super) signal_handle: driver::SignalHandle, /// Handles to the time drivers #[cfg_attr(not(feature = "time"), allow(dead_code))] pub(super) time_handle: driver::TimeHandle, /// Source of `Instant::now()` #[cfg_attr(not(all(feature = "time", feature = "test-util")), ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
d7b3b33c9c95935c4eba70293d75a870a5d5ba24
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d7b3b33c9c95935c4eba70293d75a870a5d5ba24/tokio/src/runtime/handle.rs
41
100
tokio-rs/tokio:tokio/src/runtime/handle.rs:5
/// ``` /// use tokio::runtime::Runtime; /// /// # fn dox() { /// // Create the runtime /// let rt = Runtime::new().unwrap(); /// // Get a handle from this runtime /// let handle = rt.handle(); /// /// // Spawn a future onto the runtime using the handle /// handle.spawn(async { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
d7b3b33c9c95935c4eba70293d75a870a5d5ba24
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d7b3b33c9c95935c4eba70293d75a870a5d5ba24/tokio/src/runtime/handle.rs
161
220
tokio-rs/tokio:tokio/src/runtime/handle.rs:8
/// [`Runtime::shutdown_background`]: fn@crate::runtime::Runtime::shutdown_background /// [`Runtime::shutdown_timeout`]: fn@crate::runtime::Runtime::shutdown_timeout /// [`spawn_blocking`]: crate::task::spawn_blocking /// [`tokio::fs`]: crate::fs /// [`tokio::net`]: crate::net /// [`tokio::time`]: c...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
d7b3b33c9c95935c4eba70293d75a870a5d5ba24
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d7b3b33c9c95935c4eba70293d75a870a5d5ba24/tokio/src/runtime/handle.rs
281
340
tokio-rs/tokio:tokio/src/runtime/handle.rs:9
impl ToHandle for Handle { fn to_handle(&self) -> Handle { self.clone() } } cfg_metrics! { use crate::runtime::RuntimeMetrics; impl Handle { /// Returns a view that lets you get information about how the runtime /// is performing. pub fn metrics(&self) -> RuntimeMetrics...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
d7b3b33c9c95935c4eba70293d75a870a5d5ba24
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d7b3b33c9c95935c4eba70293d75a870a5d5ba24/tokio/src/runtime/handle.rs
321
380
tokio-rs/tokio:tokio/src/runtime/handle.rs:10
pub fn is_missing_context(&self) -> bool { matches!(self.kind, TryCurrentErrorKind::NoContext) } /// Returns true if the call failed because the Tokio context thread-local /// had been destroyed. This can usually only happen if in the destructor of /// other thread-locals. pub fn is_thread_...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
d7b3b33c9c95935c4eba70293d75a870a5d5ba24
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d7b3b33c9c95935c4eba70293d75a870a5d5ba24/tokio/src/runtime/handle.rs
361
398
tokio-rs/tokio:tokio/src/runtime/handle.rs:1
use crate::runtime::blocking::{BlockingTask, NoopSchedule}; use crate::runtime::task::{self, JoinHandle}; use crate::runtime::{blocking, context, driver, Spawner}; use crate::util::error::{CONTEXT_MISSING_ERROR, THREAD_LOCAL_DESTROYED_ERROR}; use std::future::Future; use std::marker::PhantomData; use std::{error, fmt}...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
1578575db8d0bc7838f7ea2ddbe7194ac2f4aa87
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1578575db8d0bc7838f7ea2ddbe7194ac2f4aa87/tokio/src/runtime/handle.rs
1
60
tokio-rs/tokio:tokio/src/runtime/handle.rs:2
), allow(dead_code) )] pub(super) signal_handle: driver::SignalHandle, /// Handles to the time drivers #[cfg_attr(not(feature = "time"), allow(dead_code))] pub(super) time_handle: driver::TimeHandle, /// Source of `Instant::now()` #[cfg_attr(not(all(feature = "time", feature = "tes...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
1578575db8d0bc7838f7ea2ddbe7194ac2f4aa87
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1578575db8d0bc7838f7ea2ddbe7194ac2f4aa87/tokio/src/runtime/handle.rs
41
100
tokio-rs/tokio:tokio/src/runtime/handle.rs:5
/// /// ``` /// use tokio::runtime::Runtime; /// /// # fn dox() { /// // Create the runtime /// let rt = Runtime::new().unwrap(); /// // Get a handle from this runtime /// let handle = rt.handle(); /// /// // Spawn a future onto the runtime using the handle /// handle.spawn(a...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
1578575db8d0bc7838f7ea2ddbe7194ac2f4aa87
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1578575db8d0bc7838f7ea2ddbe7194ac2f4aa87/tokio/src/runtime/handle.rs
161
220
tokio-rs/tokio:tokio/src/runtime/handle.rs:8
/// [`Runtime::block_on`]: fn@crate::runtime::Runtime::block_on /// [`Runtime::shutdown_background`]: fn@crate::runtime::Runtime::shutdown_background /// [`Runtime::shutdown_timeout`]: fn@crate::runtime::Runtime::shutdown_timeout /// [`spawn_blocking`]: crate::task::spawn_blocking /// [`tokio::fs`]: cra...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
1578575db8d0bc7838f7ea2ddbe7194ac2f4aa87
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1578575db8d0bc7838f7ea2ddbe7194ac2f4aa87/tokio/src/runtime/handle.rs
281
340
tokio-rs/tokio:tokio/src/runtime/handle.rs:9
} impl ToHandle for Handle { fn to_handle(&self) -> Handle { self.clone() } } cfg_metrics! { use crate::runtime::RuntimeMetrics; impl Handle { /// Returns a view that lets you get information about how the runtime /// is performing. pub fn metrics(&self) -> RuntimeMetr...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
1578575db8d0bc7838f7ea2ddbe7194ac2f4aa87
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1578575db8d0bc7838f7ea2ddbe7194ac2f4aa87/tokio/src/runtime/handle.rs
321
380
tokio-rs/tokio:tokio/src/runtime/handle.rs:10
panic!("OS can't spawn worker thread: {}", e) } } } cfg_fs! { #[track_caller] #[cfg_attr(any( all(loom, not(test)), // the function is covered by loom tests test ), allow(dead_code))] pub(crate) fn spawn_mandatory_blocking<F, R>(&self,...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
1578575db8d0bc7838f7ea2ddbe7194ac2f4aa87
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1578575db8d0bc7838f7ea2ddbe7194ac2f4aa87/tokio/src/runtime/handle.rs
361
420
tokio-rs/tokio:tokio/src/runtime/handle.rs:11
#[track_caller] pub(crate) fn spawn_blocking_inner<F, R>( &self, func: F, is_mandatory: blocking::Mandatory, name: Option<&str>, rt: &dyn ToHandle, ) -> (JoinHandle<R>, Result<(), blocking::SpawnError>) where F: FnOnce() -> R + Send + 'static, R: Send ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
1578575db8d0bc7838f7ea2ddbe7194ac2f4aa87
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1578575db8d0bc7838f7ea2ddbe7194ac2f4aa87/tokio/src/runtime/handle.rs
401
460
tokio-rs/tokio:tokio/src/runtime/handle.rs:1
use crate::runtime::blocking::{BlockingTask, NoopSchedule}; use crate::runtime::task::{self, JoinHandle}; use crate::runtime::{blocking, context, driver, Spawner}; use crate::util::error::{CONTEXT_MISSING_ERROR, THREAD_LOCAL_DESTROYED_ERROR}; use std::future::Future; use std::marker::PhantomData; use std::{error, fmt}...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
3b6c74a40ad87837ab53c105a323c2807a4e1b38
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3b6c74a40ad87837ab53c105a323c2807a4e1b38/tokio/src/runtime/handle.rs
1
60
tokio-rs/tokio:tokio/src/runtime/handle.rs:2
/// Handles to the time drivers #[cfg_attr(not(feature = "time"), allow(dead_code))] pub(super) time_handle: driver::TimeHandle, /// Source of `Instant::now()` #[cfg_attr(not(all(feature = "time", feature = "test-util")), allow(dead_code))] pub(super) clock: driver::Clock, /// Blocking pool sp...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
3b6c74a40ad87837ab53c105a323c2807a4e1b38
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3b6c74a40ad87837ab53c105a323c2807a4e1b38/tokio/src/runtime/handle.rs
41
100
tokio-rs/tokio:tokio/src/runtime/handle.rs:4
/// // and created an EnterGuard /// // let handle2 = Handle::current(); // panic /// // So we create a guard here with Handle::enter(); /// let _guard = handle.enter(); /// // Now we can call Handle::current(); /// let handle2 = Handle::current(); /// }); /// # handl...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
3b6c74a40ad87837ab53c105a323c2807a4e1b38
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3b6c74a40ad87837ab53c105a323c2807a4e1b38/tokio/src/runtime/handle.rs
121
180
tokio-rs/tokio:tokio/src/runtime/handle.rs:5
/// # fn dox() { /// // Create the runtime /// let rt = Runtime::new().unwrap(); /// // Get a handle from this runtime /// let handle = rt.handle(); /// /// // Spawn a future onto the runtime using the handle /// handle.spawn(async { /// println!("now running on a worker thread"); ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
3b6c74a40ad87837ab53c105a323c2807a4e1b38
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3b6c74a40ad87837ab53c105a323c2807a4e1b38/tokio/src/runtime/handle.rs
161
220
tokio-rs/tokio:tokio/src/runtime/handle.rs:8
/// [`tokio::fs`]: crate::fs /// [`tokio::net`]: crate::net /// [`tokio::time`]: crate::time #[track_caller] pub fn block_on<F: Future>(&self, future: F) -> F::Output { #[cfg(all(tokio_unstable, feature = "tracing"))] let future = crate::util::trace::task(future, "block_on", ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
3b6c74a40ad87837ab53c105a323c2807a4e1b38
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3b6c74a40ad87837ab53c105a323c2807a4e1b38/tokio/src/runtime/handle.rs
281
340
tokio-rs/tokio:tokio/src/runtime/handle.rs:9
self.clone() } } cfg_metrics! { use crate::runtime::RuntimeMetrics; impl Handle { /// Returns a view that lets you get information about how the runtime /// is performing. pub fn metrics(&self) -> RuntimeMetrics { RuntimeMetrics::new(self.clone()) } } } imp...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
3b6c74a40ad87837ab53c105a323c2807a4e1b38
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3b6c74a40ad87837ab53c105a323c2807a4e1b38/tokio/src/runtime/handle.rs
321
380
tokio-rs/tokio:tokio/src/runtime/handle.rs:10
cfg_fs! { #[track_caller] #[cfg_attr(any( all(loom, not(test)), // the function is covered by loom tests test ), allow(dead_code))] pub(crate) fn spawn_mandatory_blocking<F, R>(&self, rt: &dyn ToHandle, func: F) -> Option<JoinHandle<R>> where F...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
3b6c74a40ad87837ab53c105a323c2807a4e1b38
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3b6c74a40ad87837ab53c105a323c2807a4e1b38/tokio/src/runtime/handle.rs
361
420
tokio-rs/tokio:tokio/src/runtime/handle.rs:11
is_mandatory: blocking::Mandatory, name: Option<&str>, rt: &dyn ToHandle, ) -> (JoinHandle<R>, Result<(), blocking::SpawnError>) where F: FnOnce() -> R + Send + 'static, R: Send + 'static, { let fut = BlockingTask::new(func); let id = super::task::Id::next(); ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
3b6c74a40ad87837ab53c105a323c2807a4e1b38
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3b6c74a40ad87837ab53c105a323c2807a4e1b38/tokio/src/runtime/handle.rs
401
460
tokio-rs/tokio:tokio/src/runtime/handle.rs:12
kind: TryCurrentErrorKind, } impl TryCurrentError { pub(crate) fn new_no_context() -> Self { Self { kind: TryCurrentErrorKind::NoContext, } } pub(crate) fn new_thread_local_destroyed() -> Self { Self { kind: TryCurrentErrorKind::ThreadLocalDestroyed, ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
3b6c74a40ad87837ab53c105a323c2807a4e1b38
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3b6c74a40ad87837ab53c105a323c2807a4e1b38/tokio/src/runtime/handle.rs
441
496
tokio-rs/tokio:tokio/src/runtime/handle.rs:13
ThreadLocalDestroyed => f.write_str("ThreadLocalDestroyed"), } } } impl fmt::Display for TryCurrentError { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { use TryCurrentErrorKind::*; match self.kind { NoContext => f.write_str(CONTEXT_MISSING_ERROR), Th...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
3b6c74a40ad87837ab53c105a323c2807a4e1b38
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3b6c74a40ad87837ab53c105a323c2807a4e1b38/tokio/src/runtime/handle.rs
481
496
tokio-rs/tokio:tokio/src/runtime/handle.rs:9
self.clone() } } cfg_metrics! { use crate::runtime::RuntimeMetrics; impl Handle { /// Returns a view that lets you get information about how the runtime /// is performing. pub fn metrics(&self) -> RuntimeMetrics { RuntimeMetrics::new(self.clone()) } } } imp...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
159508b916038217ceb668d727d9618b567ea8b1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/159508b916038217ceb668d727d9618b567ea8b1/tokio/src/runtime/handle.rs
321
380
tokio-rs/tokio:tokio/src/runtime/handle.rs:10
pub(crate) fn spawn_mandatory_blocking<F, R>(&self, rt: &dyn ToHandle, func: F) -> Option<JoinHandle<R>> where F: FnOnce() -> R + Send + 'static, R: Send + 'static, { let (join_handle, was_spawned) = if cfg!(debug_assertions) && std::mem::size_of::<F>() > 2048 { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
159508b916038217ceb668d727d9618b567ea8b1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/159508b916038217ceb668d727d9618b567ea8b1/tokio/src/runtime/handle.rs
361
420
tokio-rs/tokio:tokio/src/runtime/handle.rs:11
{ let fut = BlockingTask::new(func); let id = super::task::Id::next(); #[cfg(all(tokio_unstable, feature = "tracing"))] let fut = { use tracing::Instrument; let location = std::panic::Location::caller(); let span = tracing::trace_span!( ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
159508b916038217ceb668d727d9618b567ea8b1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/159508b916038217ceb668d727d9618b567ea8b1/tokio/src/runtime/handle.rs
401
460
tokio-rs/tokio:tokio/src/runtime/handle.rs:12
} } pub(crate) fn new_thread_local_destroyed() -> Self { Self { kind: TryCurrentErrorKind::ThreadLocalDestroyed, } } /// Returns true if the call failed because there is currently no runtime in /// the Tokio context. pub fn is_missing_context(&self) -> bool { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
159508b916038217ceb668d727d9618b567ea8b1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/159508b916038217ceb668d727d9618b567ea8b1/tokio/src/runtime/handle.rs
441
489
tokio-rs/tokio:tokio/src/runtime/handle.rs:2
/// Handles to the time drivers #[cfg_attr(not(feature = "time"), allow(dead_code))] pub(super) time_handle: driver::TimeHandle, /// Source of `Instant::now()` #[cfg_attr(not(all(feature = "time", feature = "test-util")), allow(dead_code))] pub(super) clock: driver::Clock, /// Blocking pool sp...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
b1557ea5b2b0ea8d55b221e25fccb523bc1258ef
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b1557ea5b2b0ea8d55b221e25fccb523bc1258ef/tokio/src/runtime/handle.rs
41
100
tokio-rs/tokio:tokio/src/runtime/handle.rs:4
/// // and created an EnterGuard /// // let handle2 = Handle::current(); // panic /// // So we create a guard here with Handle::enter(); /// let _guard = handle.enter(); /// // Now we can call Handle::current(); /// let handle2 = Handle::current(); /// }); /// # handl...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
b1557ea5b2b0ea8d55b221e25fccb523bc1258ef
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b1557ea5b2b0ea8d55b221e25fccb523bc1258ef/tokio/src/runtime/handle.rs
121
180
tokio-rs/tokio:tokio/src/runtime/handle.rs:5
/// // Create the runtime /// let rt = Runtime::new().unwrap(); /// // Get a handle from this runtime /// let handle = rt.handle(); /// /// // Spawn a future onto the runtime using the handle /// handle.spawn(async { /// println!("now running on a worker thread"); /// }); /// # }...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
b1557ea5b2b0ea8d55b221e25fccb523bc1258ef
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b1557ea5b2b0ea8d55b221e25fccb523bc1258ef/tokio/src/runtime/handle.rs
161
220
tokio-rs/tokio:tokio/src/runtime/handle.rs:8
/// [`tokio::net`]: crate::net /// [`tokio::time`]: crate::time #[track_caller] pub fn block_on<F: Future>(&self, future: F) -> F::Output { #[cfg(all(tokio_unstable, feature = "tracing"))] let future = crate::util::trace::task(future, "block_on", None, super::task::Id::next().as_...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
b1557ea5b2b0ea8d55b221e25fccb523bc1258ef
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b1557ea5b2b0ea8d55b221e25fccb523bc1258ef/tokio/src/runtime/handle.rs
281
340
tokio-rs/tokio:tokio/src/runtime/handle.rs:9
} } cfg_metrics! { use crate::runtime::RuntimeMetrics; impl Handle { /// Returns a view that lets you get information about how the runtime /// is performing. pub fn metrics(&self) -> RuntimeMetrics { RuntimeMetrics::new(self.clone()) } } } impl HandleInner { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
b1557ea5b2b0ea8d55b221e25fccb523bc1258ef
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b1557ea5b2b0ea8d55b221e25fccb523bc1258ef/tokio/src/runtime/handle.rs
321
380
tokio-rs/tokio:tokio/src/runtime/handle.rs:10
where F: FnOnce() -> R + Send + 'static, R: Send + 'static, { let (join_handle, was_spawned) = if cfg!(debug_assertions) && std::mem::size_of::<F>() > 2048 { self.spawn_blocking_inner( Box::new(func), blocking::Mandatory...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
b1557ea5b2b0ea8d55b221e25fccb523bc1258ef
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b1557ea5b2b0ea8d55b221e25fccb523bc1258ef/tokio/src/runtime/handle.rs
361
420
tokio-rs/tokio:tokio/src/runtime/handle.rs:11
let fut = BlockingTask::new(func); let id = super::task::Id::next(); #[cfg(all(tokio_unstable, feature = "tracing"))] let fut = { use tracing::Instrument; let location = std::panic::Location::caller(); let span = tracing::trace_span!( target: "...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
b1557ea5b2b0ea8d55b221e25fccb523bc1258ef
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b1557ea5b2b0ea8d55b221e25fccb523bc1258ef/tokio/src/runtime/handle.rs
401
460
tokio-rs/tokio:tokio/src/runtime/handle.rs:12
} pub(crate) fn new_thread_local_destroyed() -> Self { Self { kind: TryCurrentErrorKind::ThreadLocalDestroyed, } } /// Returns true if the call failed because there is currently no runtime in /// the Tokio context. pub fn is_missing_context(&self) -> bool { matc...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
b1557ea5b2b0ea8d55b221e25fccb523bc1258ef
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b1557ea5b2b0ea8d55b221e25fccb523bc1258ef/tokio/src/runtime/handle.rs
441
488
tokio-rs/tokio:tokio/src/runtime/handle.rs:4
/// // and created an EnterGuard /// // let handle2 = Handle::current(); // panic /// // So we create a guard here with Handle::enter(); /// let _guard = handle.enter(); /// // Now we can call Handle::current(); /// let handle2 = Handle::current(); /// }); /// # handl...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
1d3f12304e29dbb8fe3ef4089d01d5acb9edaae1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1d3f12304e29dbb8fe3ef4089d01d5acb9edaae1/tokio/src/runtime/handle.rs
121
180
tokio-rs/tokio:tokio/src/runtime/handle.rs:5
/// // Create the runtime /// let rt = Runtime::new().unwrap(); /// // Get a handle from this runtime /// let handle = rt.handle(); /// /// // Spawn a future onto the runtime using the handle /// handle.spawn(async { /// println!("now running on a worker thread"); /// }); /// # }...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
1d3f12304e29dbb8fe3ef4089d01d5acb9edaae1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1d3f12304e29dbb8fe3ef4089d01d5acb9edaae1/tokio/src/runtime/handle.rs
161
220
tokio-rs/tokio:tokio/src/runtime/handle.rs:8
/// [`Runtime::shutdown_timeout`]: fn@crate::runtime::Runtime::shutdown_timeout /// [`spawn_blocking`]: crate::task::spawn_blocking /// [`tokio::fs`]: crate::fs /// [`tokio::net`]: crate::net /// [`tokio::time`]: crate::time #[track_caller] pub fn block_on<F: Future>(&self, future: F) -> F::Outp...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
1d3f12304e29dbb8fe3ef4089d01d5acb9edaae1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1d3f12304e29dbb8fe3ef4089d01d5acb9edaae1/tokio/src/runtime/handle.rs
281
340
tokio-rs/tokio:tokio/src/runtime/handle.rs:9
pub fn metrics(&self) -> RuntimeMetrics { RuntimeMetrics::new(self.clone()) } } } impl HandleInner { #[track_caller] pub(crate) fn spawn_blocking<F, R>(&self, rt: &dyn ToHandle, func: F) -> JoinHandle<R> where F: FnOnce() -> R + Send + 'static, R: Send + 'static, ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
1d3f12304e29dbb8fe3ef4089d01d5acb9edaae1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1d3f12304e29dbb8fe3ef4089d01d5acb9edaae1/tokio/src/runtime/handle.rs
321
380
tokio-rs/tokio:tokio/src/runtime/handle.rs:10
rt, ) } else { self.spawn_blocking_inner( func, blocking::Mandatory::Mandatory, None, rt, ) }; if was_spawned { Some(join_handle) ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
1d3f12304e29dbb8fe3ef4089d01d5acb9edaae1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1d3f12304e29dbb8fe3ef4089d01d5acb9edaae1/tokio/src/runtime/handle.rs
361
420
tokio-rs/tokio:tokio/src/runtime/handle.rs:11
kind = %"blocking", task.name = %name.unwrap_or_default(), task.id = id.as_u64(), "fn" = %std::any::type_name::<F>(), spawn.location = %format_args!("{}:{}:{}", location.file(), location.line(), location.column()), ); fut.instrument...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
1d3f12304e29dbb8fe3ef4089d01d5acb9edaae1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1d3f12304e29dbb8fe3ef4089d01d5acb9edaae1/tokio/src/runtime/handle.rs
401
460
tokio-rs/tokio:tokio/src/runtime/handle.rs:12
/// the Tokio context. pub fn is_missing_context(&self) -> bool { matches!(self.kind, TryCurrentErrorKind::NoContext) } /// Returns true if the call failed because the Tokio context thread-local /// had been destroyed. This can usually only happen if in the destructor of /// other thread-lo...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
1d3f12304e29dbb8fe3ef4089d01d5acb9edaae1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1d3f12304e29dbb8fe3ef4089d01d5acb9edaae1/tokio/src/runtime/handle.rs
441
479
tokio-rs/tokio:tokio/src/runtime/handle.rs:4
/// // and created an EnterGuard /// // let handle2 = Handle::current(); // panic /// // So we create a guard here with Handle::enter(); /// let _guard = handle.enter(); /// // Now we can call Handle::current(); /// let handle2 = Handle::current(); /// }); /// # handl...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
911a0efa87e36f0dffb13e3d52340d5c08415db1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/911a0efa87e36f0dffb13e3d52340d5c08415db1/tokio/src/runtime/handle.rs
121
180
tokio-rs/tokio:tokio/src/runtime/handle.rs:5
/// // Create the runtime /// let rt = Runtime::new().unwrap(); /// // Get a handle from this runtime /// let handle = rt.handle(); /// /// // Spawn a future onto the runtime using the handle /// handle.spawn(async { /// println!("now running on a worker thread"); /// }); /// # }...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
911a0efa87e36f0dffb13e3d52340d5c08415db1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/911a0efa87e36f0dffb13e3d52340d5c08415db1/tokio/src/runtime/handle.rs
161
220
tokio-rs/tokio:tokio/src/runtime/handle.rs:8
/// [`spawn_blocking`]: crate::task::spawn_blocking /// [`tokio::fs`]: crate::fs /// [`tokio::net`]: crate::net /// [`tokio::time`]: crate::time #[track_caller] pub fn block_on<F: Future>(&self, future: F) -> F::Output { #[cfg(all(tokio_unstable, feature = "tracing"))] let future = c...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
911a0efa87e36f0dffb13e3d52340d5c08415db1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/911a0efa87e36f0dffb13e3d52340d5c08415db1/tokio/src/runtime/handle.rs
281
340