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:9
} } } 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, { let (join_handle, _was_spawned) = if cfg!(debug_assertions) && std::mem::...
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
321
380
tokio-rs/tokio:tokio/src/runtime/handle.rs:10
} else { self.spawn_blocking_inner( func, blocking::Mandatory::Mandatory, None, rt, ) }; if was_spawned { Some(join_handle) } else { None ...
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
361
420
tokio-rs/tokio:tokio/src/runtime/handle.rs:11
"fn" = %std::any::type_name::<F>(), spawn.location = %format_args!("{}:{}:{}", location.file(), location.line(), location.column()), ); fut.instrument(span) }; #[cfg(not(all(tokio_unstable, feature = "tracing")))] let _ = name; let (task, handle)...
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
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
b98a7e4d07b6f3c4402fe377dc63c3ef1ac030a8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b98a7e4d07b6f3c4402fe377dc63c3ef1ac030a8/tokio/src/runtime/handle.rs
1
60
tokio-rs/tokio:tokio/src/runtime/handle.rs:2
/// Source of `Instant::now()` #[cfg_attr(not(all(feature = "time", feature = "test-util")), allow(dead_code))] pub(super) clock: driver::Clock, /// Blocking pool spawner pub(super) blocking_spawner: blocking::Spawner, } /// Runtime context guard. /// /// Returned by [`Runtime::enter`] and [`Handle::e...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
b98a7e4d07b6f3c4402fe377dc63c3ef1ac030a8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b98a7e4d07b6f3c4402fe377dc63c3ef1ac030a8/tokio/src/runtime/handle.rs
41
100
tokio-rs/tokio:tokio/src/runtime/handle.rs:4
/// # } /// ``` pub fn current() -> Self { context::current() } /// Returns a Handle view over the currently running Runtime /// /// Returns an error if no Runtime has been started /// /// Contrary to `current`, this never panics pub fn try_current() -> Result<Self, TryCurre...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
b98a7e4d07b6f3c4402fe377dc63c3ef1ac030a8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b98a7e4d07b6f3c4402fe377dc63c3ef1ac030a8/tokio/src/runtime/handle.rs
121
180
tokio-rs/tokio:tokio/src/runtime/handle.rs:5
/// # } /// ``` #[track_caller] pub fn spawn<F>(&self, future: F) -> JoinHandle<F::Output> where F: Future + Send + 'static, F::Output: Send + 'static, { #[cfg(all(tokio_unstable, feature = "tracing"))] let future = crate::util::trace::task(future, "task", None); ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
b98a7e4d07b6f3c4402fe377dc63c3ef1ac030a8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b98a7e4d07b6f3c4402fe377dc63c3ef1ac030a8/tokio/src/runtime/handle.rs
161
220
tokio-rs/tokio:tokio/src/runtime/handle.rs:6
self.spawn_blocking_inner(Box::new(func), blocking::Mandatory::NonMandatory, None) } else { self.spawn_blocking_inner(func, blocking::Mandatory::NonMandatory, None) }; join_handle } cfg_fs! { #[track_caller] #[cfg_attr(any( all(loom, ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
b98a7e4d07b6f3c4402fe377dc63c3ef1ac030a8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b98a7e4d07b6f3c4402fe377dc63c3ef1ac030a8/tokio/src/runtime/handle.rs
201
260
tokio-rs/tokio:tokio/src/runtime/handle.rs:7
#[track_caller] pub(crate) fn spawn_blocking_inner<F, R>( &self, func: F, is_mandatory: blocking::Mandatory, name: Option<&str>, ) -> (JoinHandle<R>, bool) where F: FnOnce() -> R + Send + 'static, R: Send + 'static, { let fut = BlockingTask::new(fu...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
b98a7e4d07b6f3c4402fe377dc63c3ef1ac030a8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b98a7e4d07b6f3c4402fe377dc63c3ef1ac030a8/tokio/src/runtime/handle.rs
241
300
tokio-rs/tokio:tokio/src/runtime/handle.rs:9
/// }); /// ``` /// /// Or using `Handle::current`: /// /// ``` /// use tokio::runtime::Handle; /// /// #[tokio::main] /// async fn main () { /// let handle = Handle::current(); /// std::thread::spawn(move || { /// // Using Handle::block_on to run async co...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
b98a7e4d07b6f3c4402fe377dc63c3ef1ac030a8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b98a7e4d07b6f3c4402fe377dc63c3ef1ac030a8/tokio/src/runtime/handle.rs
321
380
tokio-rs/tokio:tokio/src/runtime/handle.rs:10
// Block on the future blocking_enter .block_on(future) .expect("failed to park thread") } pub(crate) fn shutdown(mut self) { self.spawner.shutdown(); } } cfg_metrics! { use crate::runtime::RuntimeMetrics; impl Handle { /// Returns a view that lets ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
b98a7e4d07b6f3c4402fe377dc63c3ef1ac030a8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b98a7e4d07b6f3c4402fe377dc63c3ef1ac030a8/tokio/src/runtime/handle.rs
361
420
tokio-rs/tokio:tokio/src/runtime/handle.rs:11
} /// 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 thread-local /// had been...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
b98a7e4d07b6f3c4402fe377dc63c3ef1ac030a8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b98a7e4d07b6f3c4402fe377dc63c3ef1ac030a8/tokio/src/runtime/handle.rs
401
442
tokio-rs/tokio:tokio/src/runtime/handle.rs:2
/// Source of `Instant::now()` #[cfg_attr(not(all(feature = "time", feature = "test-util")), allow(dead_code))] pub(super) clock: driver::Clock, /// Blocking pool spawner pub(super) blocking_spawner: blocking::Spawner, } /// Runtime context guard. /// /// Returned by [`Runtime::enter`] and [`Handle::e...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
7aad428994120b2b37cdbefd7b1dd351555c92a3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7aad428994120b2b37cdbefd7b1dd351555c92a3/tokio/src/runtime/handle.rs
41
100
tokio-rs/tokio:tokio/src/runtime/handle.rs:5
{ #[cfg(all(tokio_unstable, feature = "tracing"))] let future = crate::util::trace::task(future, "task", None); self.spawner.spawn(future) } /// Runs the provided function on an executor dedicated to blocking. /// operations. /// /// # Examples /// /// ``` /// us...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
7aad428994120b2b37cdbefd7b1dd351555c92a3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7aad428994120b2b37cdbefd7b1dd351555c92a3/tokio/src/runtime/handle.rs
161
220
tokio-rs/tokio:tokio/src/runtime/handle.rs:6
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, func: F) -> Option<JoinHandle<R>> where F: FnOnce() -> R + S...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
7aad428994120b2b37cdbefd7b1dd351555c92a3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7aad428994120b2b37cdbefd7b1dd351555c92a3/tokio/src/runtime/handle.rs
201
260
tokio-rs/tokio:tokio/src/runtime/handle.rs:7
) -> (JoinHandle<R>, bool) where F: FnOnce() -> R + Send + 'static, R: Send + 'static, { let fut = BlockingTask::new(func); #[cfg(all(tokio_unstable, feature = "tracing"))] let fut = { use tracing::Instrument; let location = std::panic::Location::...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
7aad428994120b2b37cdbefd7b1dd351555c92a3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7aad428994120b2b37cdbefd7b1dd351555c92a3/tokio/src/runtime/handle.rs
241
300
tokio-rs/tokio:tokio/src/runtime/handle.rs:9
/// /// #[tokio::main] /// async fn main () { /// let handle = Handle::current(); /// std::thread::spawn(move || { /// // Using Handle::block_on to run async code in the new thread. /// handle.block_on(async { /// println!("hello"); /// }); ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
7aad428994120b2b37cdbefd7b1dd351555c92a3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7aad428994120b2b37cdbefd7b1dd351555c92a3/tokio/src/runtime/handle.rs
321
380
tokio-rs/tokio:tokio/src/runtime/handle.rs:10
self.spawner.shutdown(); } } 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()) } ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
7aad428994120b2b37cdbefd7b1dd351555c92a3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7aad428994120b2b37cdbefd7b1dd351555c92a3/tokio/src/runtime/handle.rs
361
420
tokio-rs/tokio:tokio/src/runtime/handle.rs:11
/// 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_local_destroyed(&self) -> bool { matches!(self.kind, TryCurrentErrorKind::ThreadLocalDestroyed) } } e...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
7aad428994120b2b37cdbefd7b1dd351555c92a3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7aad428994120b2b37cdbefd7b1dd351555c92a3/tokio/src/runtime/handle.rs
401
435
tokio-rs/tokio:tokio/src/runtime/handle.rs:5
{ #[cfg(all(tokio_unstable, feature = "tracing"))] let future = crate::util::trace::task(future, "task", None); self.spawner.spawn(future) } /// Runs the provided function on an executor dedicated to blocking. /// operations. /// /// # Examples /// /// ``` /// us...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
24f4ee31f0266a97547a81f510726da9c1bb9ec9
github
async-runtime
https://github.com/tokio-rs/tokio/blob/24f4ee31f0266a97547a81f510726da9c1bb9ec9/tokio/src/runtime/handle.rs
161
220
tokio-rs/tokio:tokio/src/runtime/handle.rs:6
where F: FnOnce() -> R + Send + 'static, R: Send + 'static, { let fut = BlockingTask::new(func); #[cfg(all(tokio_unstable, feature = "tracing"))] let fut = { use tracing::Instrument; let location = std::panic::Location::caller(); let span ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
24f4ee31f0266a97547a81f510726da9c1bb9ec9
github
async-runtime
https://github.com/tokio-rs/tokio/blob/24f4ee31f0266a97547a81f510726da9c1bb9ec9/tokio/src/runtime/handle.rs
201
260
tokio-rs/tokio:tokio/src/runtime/handle.rs:8
/// let handle = Handle::current(); /// std::thread::spawn(move || { /// // Using Handle::block_on to run async code in the new thread. /// handle.block_on(async { /// println!("hello"); /// }); /// }); /// } /// ``` /// /// [`JoinE...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
24f4ee31f0266a97547a81f510726da9c1bb9ec9
github
async-runtime
https://github.com/tokio-rs/tokio/blob/24f4ee31f0266a97547a81f510726da9c1bb9ec9/tokio/src/runtime/handle.rs
281
340
tokio-rs/tokio:tokio/src/runtime/handle.rs:4
/// /// Returns an error if no Runtime has been started /// /// Contrary to `current`, this never panics pub fn try_current() -> Result<Self, TryCurrentError> { context::try_current() } cfg_stats! { /// Returns a view that lets you get information about how the runtime /...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
ee4b2ede83c661715c054d3cda170994a499c39f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ee4b2ede83c661715c054d3cda170994a499c39f/tokio/src/runtime/handle.rs
121
180
tokio-rs/tokio:tokio/src/runtime/handle.rs:5
/// }); /// # } /// ``` #[track_caller] pub fn spawn<F>(&self, future: F) -> JoinHandle<F::Output> where F: Future + Send + 'static, F::Output: Send + 'static, { #[cfg(all(tokio_unstable, feature = "tracing"))] let future = crate::util::trace::task(future, "task",...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
ee4b2ede83c661715c054d3cda170994a499c39f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ee4b2ede83c661715c054d3cda170994a499c39f/tokio/src/runtime/handle.rs
161
220
tokio-rs/tokio:tokio/src/runtime/handle.rs:6
self.spawn_blocking_inner(Box::new(func), None) } else { self.spawn_blocking_inner(func, None) } } #[track_caller] pub(crate) fn spawn_blocking_inner<F, R>(&self, func: F, name: Option<&str>) -> JoinHandle<R> where F: FnOnce() -> R + Send + 'static, R: Send +...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
ee4b2ede83c661715c054d3cda170994a499c39f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ee4b2ede83c661715c054d3cda170994a499c39f/tokio/src/runtime/handle.rs
201
260
tokio-rs/tokio:tokio/src/runtime/handle.rs:8
/// /// Or using `Handle::current`: /// /// ``` /// use tokio::runtime::Handle; /// /// #[tokio::main] /// async fn main () { /// let handle = Handle::current(); /// std::thread::spawn(move || { /// // Using Handle::block_on to run async code in the new thread. ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
ee4b2ede83c661715c054d3cda170994a499c39f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ee4b2ede83c661715c054d3cda170994a499c39f/tokio/src/runtime/handle.rs
281
340
tokio-rs/tokio:tokio/src/runtime/handle.rs:9
.block_on(future) .expect("failed to park thread") } pub(crate) fn shutdown(mut self) { self.spawner.shutdown(); } } /// Error returned by `try_current` when no Runtime has been started #[derive(Debug)] pub struct TryCurrentError { kind: TryCurrentErrorKind, } impl TryCurrentError...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
ee4b2ede83c661715c054d3cda170994a499c39f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ee4b2ede83c661715c054d3cda170994a499c39f/tokio/src/runtime/handle.rs
321
380
tokio-rs/tokio:tokio/src/runtime/handle.rs:10
} enum TryCurrentErrorKind { NoContext, ThreadLocalDestroyed, } impl fmt::Debug for TryCurrentErrorKind { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { use TryCurrentErrorKind::*; match self { NoContext => f.write_str("NoContext"), ThreadLocalDestroyed ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
ee4b2ede83c661715c054d3cda170994a499c39f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ee4b2ede83c661715c054d3cda170994a499c39f/tokio/src/runtime/handle.rs
361
388
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
cf3206842c0d94ecdaaeb421a58b1c963b627c3d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/cf3206842c0d94ecdaaeb421a58b1c963b627c3d/tokio/src/runtime/handle.rs
1
60
tokio-rs/tokio:tokio/src/runtime/handle.rs:2
/// Blocking pool spawner pub(super) blocking_spawner: blocking::Spawner, } /// 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 #[derive(Debug)] #[must_use = "...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
cf3206842c0d94ecdaaeb421a58b1c963b627c3d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/cf3206842c0d94ecdaaeb421a58b1c963b627c3d/tokio/src/runtime/handle.rs
41
100
tokio-rs/tokio:tokio/src/runtime/handle.rs:4
pub fn try_current() -> Result<Self, TryCurrentError> { context::try_current() } cfg_stats! { /// Returns a view that lets you get information about how the runtime /// is performing. pub fn stats(&self) -> &crate::runtime::stats::RuntimeStats { self.spawner.stats() ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
cf3206842c0d94ecdaaeb421a58b1c963b627c3d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/cf3206842c0d94ecdaaeb421a58b1c963b627c3d/tokio/src/runtime/handle.rs
121
180
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, { #[cfg(all(tokio_unstable, feature = "tracing"))] let future = crate::util::trace::task(future, "task", None); self.spawner.spawn(future) } //...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
cf3206842c0d94ecdaaeb421a58b1c963b627c3d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/cf3206842c0d94ecdaaeb421a58b1c963b627c3d/tokio/src/runtime/handle.rs
161
220
tokio-rs/tokio:tokio/src/runtime/handle.rs:6
} #[track_caller] pub(crate) fn spawn_blocking_inner<F, R>(&self, func: F, name: Option<&str>) -> JoinHandle<R> where F: FnOnce() -> R + Send + 'static, R: Send + 'static, { let fut = BlockingTask::new(func); #[cfg(all(tokio_unstable, feature = "tracing"))] let ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
cf3206842c0d94ecdaaeb421a58b1c963b627c3d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/cf3206842c0d94ecdaaeb421a58b1c963b627c3d/tokio/src/runtime/handle.rs
201
260
tokio-rs/tokio:tokio/src/runtime/handle.rs:8
/// use tokio::runtime::Handle; /// /// #[tokio::main] /// async fn main () { /// let handle = Handle::current(); /// std::thread::spawn(move || { /// // Using Handle::block_on to run async code in the new thread. /// handle.block_on(async { /// printl...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
cf3206842c0d94ecdaaeb421a58b1c963b627c3d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/cf3206842c0d94ecdaaeb421a58b1c963b627c3d/tokio/src/runtime/handle.rs
281
340
tokio-rs/tokio:tokio/src/runtime/handle.rs:9
pub(crate) fn shutdown(mut self) { self.spawner.shutdown(); } } /// 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 { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
cf3206842c0d94ecdaaeb421a58b1c963b627c3d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/cf3206842c0d94ecdaaeb421a58b1c963b627c3d/tokio/src/runtime/handle.rs
321
380
tokio-rs/tokio:tokio/src/runtime/handle.rs:10
ThreadLocalDestroyed, } 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
cf3206842c0d94ecdaaeb421a58b1c963b627c3d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/cf3206842c0d94ecdaaeb421a58b1c963b627c3d/tokio/src/runtime/handle.rs
361
384
tokio-rs/tokio:tokio/src/runtime/handle.rs:4
pub fn try_current() -> Result<Self, TryCurrentError> { context::try_current() } cfg_stats! { /// Returns a view that lets you get information about how the runtime /// is performing. pub fn stats(&self) -> &crate::runtime::stats::RuntimeStats { self.spawner.stats() ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
1f8105588c06c41c90c3c77628d10cde4b3b2edb
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1f8105588c06c41c90c3c77628d10cde4b3b2edb/tokio/src/runtime/handle.rs
121
180
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, { #[cfg(all(tokio_unstable, feature = "tracing"))] let future = crate::util::trace::task(future, "task", None); self.spawner.spawn(future) } //...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
1f8105588c06c41c90c3c77628d10cde4b3b2edb
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1f8105588c06c41c90c3c77628d10cde4b3b2edb/tokio/src/runtime/handle.rs
161
220
tokio-rs/tokio:tokio/src/runtime/handle.rs:6
} #[cfg_attr(tokio_track_caller, track_caller)] pub(crate) fn spawn_blocking_inner<F, R>(&self, func: F, name: Option<&str>) -> JoinHandle<R> where F: FnOnce() -> R + Send + 'static, R: Send + 'static, { let fut = BlockingTask::new(func); #[cfg(all(tokio_unstable, featu...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
1f8105588c06c41c90c3c77628d10cde4b3b2edb
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1f8105588c06c41c90c3c77628d10cde4b3b2edb/tokio/src/runtime/handle.rs
201
260
tokio-rs/tokio:tokio/src/runtime/handle.rs:8
/// /// // Execute the future, blocking the current thread until completion /// handle.block_on(async { /// println!("hello"); /// }); /// ``` /// /// Or using `Handle::current`: /// /// ``` /// use tokio::runtime::Handle; /// /// #[tokio::main] /// async fn main ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
1f8105588c06c41c90c3c77628d10cde4b3b2edb
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1f8105588c06c41c90c3c77628d10cde4b3b2edb/tokio/src/runtime/handle.rs
281
340
tokio-rs/tokio:tokio/src/runtime/handle.rs:9
// Enter a **blocking** context. This prevents blocking from a runtime. let mut blocking_enter = crate::runtime::enter(true); // Block on the future blocking_enter .block_on(future) .expect("failed to park thread") } pub(crate) fn shutdown(mut self) { se...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
1f8105588c06c41c90c3c77628d10cde4b3b2edb
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1f8105588c06c41c90c3c77628d10cde4b3b2edb/tokio/src/runtime/handle.rs
321
380
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; use std::future::Future; use std::marker::PhantomData; use std::{error, fmt}; /// Handle to the runtime. //...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
44a1aad8df43bef416ac91dfc4b9b5614c3d34fd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/44a1aad8df43bef416ac91dfc4b9b5614c3d34fd/tokio/src/runtime/handle.rs
1
60
tokio-rs/tokio:tokio/src/runtime/handle.rs:4
pub fn try_current() -> Result<Self, TryCurrentError> { context::current().ok_or(TryCurrentError(())) } cfg_stats! { /// Returns a view that lets you get information about how the runtime /// is performing. pub fn stats(&self) -> &crate::runtime::stats::RuntimeStats { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
44a1aad8df43bef416ac91dfc4b9b5614c3d34fd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/44a1aad8df43bef416ac91dfc4b9b5614c3d34fd/tokio/src/runtime/handle.rs
121
180
tokio-rs/tokio:tokio/src/runtime/handle.rs:8
/// /// // Execute the future, blocking the current thread until completion /// handle.block_on(async { /// println!("hello"); /// }); /// ``` /// /// Or using `Handle::current`: /// /// ``` /// use tokio::runtime::Handle; /// /// #[tokio::main] /// async fn main ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
44a1aad8df43bef416ac91dfc4b9b5614c3d34fd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/44a1aad8df43bef416ac91dfc4b9b5614c3d34fd/tokio/src/runtime/handle.rs
281
340
tokio-rs/tokio:tokio/src/runtime/handle.rs:9
// Enter a **blocking** context. This prevents blocking from a runtime. let mut blocking_enter = crate::runtime::enter(true); // Block on the future blocking_enter .block_on(future) .expect("failed to park thread") } pub(crate) fn shutdown(mut self) { se...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
44a1aad8df43bef416ac91dfc4b9b5614c3d34fd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/44a1aad8df43bef416ac91dfc4b9b5614c3d34fd/tokio/src/runtime/handle.rs
321
351
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, { #[cfg(all(tokio_unstable, feature = "tracing"))] let future = crate::util::trace::task(future, "task", None); self.spawner.spawn(future) } //...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
9cb495cdb841bb328cf188be030b8aa3adc31a8f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/9cb495cdb841bb328cf188be030b8aa3adc31a8f/tokio/src/runtime/handle.rs
161
220
tokio-rs/tokio:tokio/src/runtime/handle.rs:6
where F: FnOnce() -> R + Send + 'static, R: Send + 'static, { let fut = BlockingTask::new(func); #[cfg(all(tokio_unstable, feature = "tracing"))] let fut = { use tracing::Instrument; #[cfg(tokio_track_caller)] let location = std::panic::Lo...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
9cb495cdb841bb328cf188be030b8aa3adc31a8f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/9cb495cdb841bb328cf188be030b8aa3adc31a8f/tokio/src/runtime/handle.rs
201
260
tokio-rs/tokio:tokio/src/runtime/handle.rs:8
/// }); /// ``` /// /// Or using `Handle::current`: /// /// ``` /// use tokio::runtime::Handle; /// /// #[tokio::main] /// async fn main () { /// let handle = Handle::current(); /// std::thread::spawn(move || { /// // Using Handle::block_on to run async co...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
9cb495cdb841bb328cf188be030b8aa3adc31a8f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/9cb495cdb841bb328cf188be030b8aa3adc31a8f/tokio/src/runtime/handle.rs
281
340
tokio-rs/tokio:tokio/src/runtime/handle.rs:9
// Block on the future blocking_enter .block_on(future) .expect("failed to park thread") } pub(crate) fn shutdown(mut self) { self.spawner.shutdown(); } } /// Error returned by `try_current` when no Runtime has been started pub struct TryCurrentError(()); impl fmt:...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
9cb495cdb841bb328cf188be030b8aa3adc31a8f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/9cb495cdb841bb328cf188be030b8aa3adc31a8f/tokio/src/runtime/handle.rs
321
347
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; use std::future::Future; use std::marker::PhantomData; use std::{error, fmt}; /// Handle to the runtime. //...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
03969cdae7674681d1b10926e6a56fbb8908dbb8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/03969cdae7674681d1b10926e6a56fbb8908dbb8/tokio/src/runtime/handle.rs
1
60
tokio-rs/tokio:tokio/src/runtime/handle.rs:5
/// Runs the provided function on an executor dedicated to blocking. /// operations. /// /// # 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
03969cdae7674681d1b10926e6a56fbb8908dbb8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/03969cdae7674681d1b10926e6a56fbb8908dbb8/tokio/src/runtime/handle.rs
161
220
tokio-rs/tokio:tokio/src/runtime/handle.rs:6
let location = std::panic::Location::caller(); #[cfg(tokio_track_caller)] let span = tracing::trace_span!( target: "tokio::task::blocking", "runtime.spawn", kind = %"blocking", task.name = %name.unwrap_or_default(), ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
03969cdae7674681d1b10926e6a56fbb8908dbb8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/03969cdae7674681d1b10926e6a56fbb8908dbb8/tokio/src/runtime/handle.rs
201
260
tokio-rs/tokio:tokio/src/runtime/handle.rs:8
/// let handle = Handle::current(); /// std::thread::spawn(move || { /// // Using Handle::block_on to run async code in the new thread. /// handle.block_on(async { /// println!("hello"); /// }); /// }); /// } /// ``` /// /// [`JoinE...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
03969cdae7674681d1b10926e6a56fbb8908dbb8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/03969cdae7674681d1b10926e6a56fbb8908dbb8/tokio/src/runtime/handle.rs
281
337
tokio-rs/tokio:tokio/src/runtime/handle.rs:9
/// Error returned by `try_current` when no Runtime has been started pub struct TryCurrentError(()); impl fmt::Debug for TryCurrentError { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("TryCurrentError").finish() } } impl fmt::Display for TryCurrentError { fn fmt(&self,...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
03969cdae7674681d1b10926e6a56fbb8908dbb8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/03969cdae7674681d1b10926e6a56fbb8908dbb8/tokio/src/runtime/handle.rs
321
337
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; use std::future::Future; use std::marker::PhantomData; use std::{error, fmt}; /// Handle to the runtime. //...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
c5d37204dc7c4a3f1de2e413f151bd7d23e7e63d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c5d37204dc7c4a3f1de2e413f151bd7d23e7e63d/tokio/src/runtime/handle.rs
1
60
tokio-rs/tokio:tokio/src/runtime/handle.rs:5
/// Run the provided function on an executor dedicated to blocking /// operations. /// /// # 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
c5d37204dc7c4a3f1de2e413f151bd7d23e7e63d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c5d37204dc7c4a3f1de2e413f151bd7d23e7e63d/tokio/src/runtime/handle.rs
161
220
tokio-rs/tokio:tokio/src/runtime/handle.rs:6
let location = std::panic::Location::caller(); #[cfg(tokio_track_caller)] let span = tracing::trace_span!( target: "tokio::task::blocking", "runtime.spawn", kind = %"blocking", task.name = %name.unwrap_or_default(), ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
c5d37204dc7c4a3f1de2e413f151bd7d23e7e63d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c5d37204dc7c4a3f1de2e413f151bd7d23e7e63d/tokio/src/runtime/handle.rs
201
260
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; use std::future::Future; use std::{error, fmt}; /// Handle to the runtime. /// /// The handle is internally...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
6ebd0575e44fe022e1bc3cf3d184044bcc4dc7a5
github
async-runtime
https://github.com/tokio-rs/tokio/blob/6ebd0575e44fe022e1bc3cf3d184044bcc4dc7a5/tokio/src/runtime/handle.rs
1
60
tokio-rs/tokio:tokio/src/runtime/handle.rs:5
/// operations. /// /// # 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 blocking functio...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
6ebd0575e44fe022e1bc3cf3d184044bcc4dc7a5
github
async-runtime
https://github.com/tokio-rs/tokio/blob/6ebd0575e44fe022e1bc3cf3d184044bcc4dc7a5/tokio/src/runtime/handle.rs
161
220
tokio-rs/tokio:tokio/src/runtime/handle.rs:6
#[cfg(tokio_track_caller)] let span = tracing::trace_span!( target: "tokio::task::blocking", "runtime.spawn", kind = %"blocking", task.name = %name.unwrap_or_default(), "fn" = %std::any::type_name::<F>(), spawn.l...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
6ebd0575e44fe022e1bc3cf3d184044bcc4dc7a5
github
async-runtime
https://github.com/tokio-rs/tokio/blob/6ebd0575e44fe022e1bc3cf3d184044bcc4dc7a5/tokio/src/runtime/handle.rs
201
260
tokio-rs/tokio:tokio/src/runtime/handle.rs:8
/// std::thread::spawn(move || { /// // Using Handle::block_on to run async code in the new thread. /// handle.block_on(async { /// println!("hello"); /// }); /// }); /// } /// ``` /// /// [`JoinError`]: struct@crate::task::JoinError //...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
6ebd0575e44fe022e1bc3cf3d184044bcc4dc7a5
github
async-runtime
https://github.com/tokio-rs/tokio/blob/6ebd0575e44fe022e1bc3cf3d184044bcc4dc7a5/tokio/src/runtime/handle.rs
281
336
tokio-rs/tokio:tokio/src/runtime/handle.rs:8
/// std::thread::spawn(move || { /// // Using Handle::block_on to run async code in the new thread. /// handle.block_on(async { /// println!("hello"); /// }); /// }); /// } /// ``` /// /// [`JoinError`]: struct@crate::task::JoinError //...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
98578a6f4a494e709f00018b1cd5b0e3dd9a0f72
github
async-runtime
https://github.com/tokio-rs/tokio/blob/98578a6f4a494e709f00018b1cd5b0e3dd9a0f72/tokio/src/runtime/handle.rs
281
332
tokio-rs/tokio:tokio/src/runtime/handle.rs:9
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("TryCurrentError").finish() } } impl fmt::Display for TryCurrentError { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.write_str(CONTEXT_MISSING_ERROR) } } impl error::Error for TryCurrentError {}
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
98578a6f4a494e709f00018b1cd5b0e3dd9a0f72
github
async-runtime
https://github.com/tokio-rs/tokio/blob/98578a6f4a494e709f00018b1cd5b0e3dd9a0f72/tokio/src/runtime/handle.rs
321
332
tokio-rs/tokio:tokio/src/runtime/handle.rs:4
/// /// [mod]: index.html /// /// # 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 fu...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
d0305d57e56dedeb9fb4854d16fe9a11d503e2a2
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d0305d57e56dedeb9fb4854d16fe9a11d503e2a2/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 blocking function onto the runtime using the handle /// handle.spawn_blocking(|| { /// println!("now running on a worker thread"); //...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
d0305d57e56dedeb9fb4854d16fe9a11d503e2a2
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d0305d57e56dedeb9fb4854d16fe9a11d503e2a2/tokio/src/runtime/handle.rs
161
220
tokio-rs/tokio:tokio/src/runtime/handle.rs:6
); #[cfg(not(tokio_track_caller))] let span = tracing::trace_span!( target: "tokio::task::blocking", "runtime.spawn", kind = %"blocking", task.name = %name.unwrap_or_default(), "fn" = %std::any::type_name::<F>(), ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
d0305d57e56dedeb9fb4854d16fe9a11d503e2a2
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d0305d57e56dedeb9fb4854d16fe9a11d503e2a2/tokio/src/runtime/handle.rs
201
260
tokio-rs/tokio:tokio/src/runtime/handle.rs:8
/// /// [`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
d0305d57e56dedeb9fb4854d16fe9a11d503e2a2
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d0305d57e56dedeb9fb4854d16fe9a11d503e2a2/tokio/src/runtime/handle.rs
281
324
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 blocking function onto the runtime using the handle /// handle.spawn_blocking(|| { /// println!("now running on a worker thread"); //...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
8198ef38814c45f9dc02fcbf826225b5cf32a6bb
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8198ef38814c45f9dc02fcbf826225b5cf32a6bb/tokio/src/runtime/handle.rs
161
220
tokio-rs/tokio:tokio/src/runtime/handle.rs:6
); #[cfg(not(tokio_track_caller))] let span = tracing::trace_span!( target: "tokio::task", "task", kind = %"blocking", task.name = %name.unwrap_or_default(), function = %std::any::type_name::<F>(), ); ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
8198ef38814c45f9dc02fcbf826225b5cf32a6bb
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8198ef38814c45f9dc02fcbf826225b5cf32a6bb/tokio/src/runtime/handle.rs
201
260
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 blocking function onto the runtime using the handle /// handle.spawn_blocking(|| { /// println!("now running on a worker thread"); //...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
2087f3e0ebb08d633d59c5f964b3901e68b3c038
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2087f3e0ebb08d633d59c5f964b3901e68b3c038/tokio/src/runtime/handle.rs
161
220
tokio-rs/tokio:tokio/src/runtime/handle.rs:6
); #[cfg(not(tokio_track_caller))] let span = tracing::trace_span!( target: "tokio::task", "task", kind = %"blocking", task.name = %name.unwrap_or_default(), function = %std::any::type_name::<F>(), ); ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
2087f3e0ebb08d633d59c5f964b3901e68b3c038
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2087f3e0ebb08d633d59c5f964b3901e68b3c038/tokio/src/runtime/handle.rs
201
260
tokio-rs/tokio:tokio/src/runtime/handle.rs:1
use crate::runtime::blocking::task::BlockingTask; use crate::runtime::task::{self, JoinHandle}; use crate::runtime::{blocking, context, driver, Spawner}; use crate::util::error::CONTEXT_MISSING_ERROR; use std::future::Future; use std::{error, fmt}; /// Handle to the runtime. /// /// The handle is internally reference...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
8fa29cb00a486c0ffc28f295c749573cb58a8967
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8fa29cb00a486c0ffc28f295c749573cb58a8967/tokio/src/runtime/handle.rs
1
60
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 blocking function onto the runtime using the handle /// handle.spawn_blocking(|| { /// println!("now running on a worker thread"); //...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
8fa29cb00a486c0ffc28f295c749573cb58a8967
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8fa29cb00a486c0ffc28f295c749573cb58a8967/tokio/src/runtime/handle.rs
161
220
tokio-rs/tokio:tokio/src/runtime/handle.rs:6
); #[cfg(not(tokio_track_caller))] let span = tracing::trace_span!( target: "tokio::task", "task", kind = %"blocking", task.name = %name.unwrap_or_default(), function = %std::any::type_name::<F>(), ); ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
8fa29cb00a486c0ffc28f295c749573cb58a8967
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8fa29cb00a486c0ffc28f295c749573cb58a8967/tokio/src/runtime/handle.rs
201
260
tokio-rs/tokio:tokio/src/runtime/handle.rs:4
/// /// [mod]: index.html /// /// # 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 fu...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
e7d74b3119178b9b86f7b547774b6b121de2239a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/e7d74b3119178b9b86f7b547774b6b121de2239a/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 blocking function onto the runtime using the handle /// handle.spawn_blocking(|| { /// println!("now running on a worker thread"); //...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
e7d74b3119178b9b86f7b547774b6b121de2239a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/e7d74b3119178b9b86f7b547774b6b121de2239a/tokio/src/runtime/handle.rs
161
220
tokio-rs/tokio:tokio/src/runtime/handle.rs:7
/// // 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"); /// }); /// ``` /// /// Or using `Handle::current`: /// /// ``` /// use t...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
e7d74b3119178b9b86f7b547774b6b121de2239a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/e7d74b3119178b9b86f7b547774b6b121de2239a/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") } pub(crate) fn shutdown(mut self) { self.spawner.shutdown(); } } /// Error returned by `try_current` when no Runt...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
e7d74b3119178b9b86f7b547774b6b121de2239a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/e7d74b3119178b9b86f7b547774b6b121de2239a/tokio/src/runtime/handle.rs
281
309
tokio-rs/tokio:tokio/src/runtime/handle.rs:4
/// /// [mod]: index.html /// /// # 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 fu...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
0bfcbc8be5368bf2a203c2c2856e5d3e7f5154b3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0bfcbc8be5368bf2a203c2c2856e5d3e7f5154b3/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 blocking function onto the runtime using the handle /// handle.spawn_blocking(|| { /// println!("now running on a worker thread"); //...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
0bfcbc8be5368bf2a203c2c2856e5d3e7f5154b3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0bfcbc8be5368bf2a203c2c2856e5d3e7f5154b3/tokio/src/runtime/handle.rs
161
220
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 blocking function onto the runtime using the handle /// handle.spawn_blocking(|| { /// println!("now running on a worker thread"); //...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
c39d9867bb989396bb02e74d87f2805969f43f03
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c39d9867bb989396bb02e74d87f2805969f43f03/tokio/src/runtime/handle.rs
161
220
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 blocking function onto the runtime using the handle /// handle.spawn_blocking(|| { /// println!("now running on a worker thread"); //...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
a1b4bdee618d7603d804db4a42fde0bd6d45c053
github
async-runtime
https://github.com/tokio-rs/tokio/blob/a1b4bdee618d7603d804db4a42fde0bd6d45c053/tokio/src/runtime/handle.rs
161
220
tokio-rs/tokio:tokio/src/runtime/handle.rs:6
let (task, handle) = task::joinable(BlockingTask::new(func)); let _ = self.blocking_spawner.spawn(task, &self); handle } } /// Error returned by `try_current` when no Runtime has been started pub struct TryCurrentError(()); impl fmt::Debug for TryCurrentError { fn fmt(&self, f: &mut fmt::Forma...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
a1b4bdee618d7603d804db4a42fde0bd6d45c053
github
async-runtime
https://github.com/tokio-rs/tokio/blob/a1b4bdee618d7603d804db4a42fde0bd6d45c053/tokio/src/runtime/handle.rs
201
222
tokio-rs/tokio:tokio/src/runtime/handle.rs:1
use crate::runtime::blocking::task::BlockingTask; use crate::runtime::task::{self, JoinHandle}; use crate::runtime::{blocking, context, driver, Spawner}; use crate::util::error::CONTEXT_MISSING_ERROR; use std::future::Future; use std::{error, fmt}; /// Handle to the runtime. /// /// The handle is internally reference...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
fdde5583f853655fec57c44928b7d5f01621b754
github
async-runtime
https://github.com/tokio-rs/tokio/blob/fdde5583f853655fec57c44928b7d5f01621b754/tokio/src/runtime/handle.rs
1
60
tokio-rs/tokio:tokio/src/runtime/handle.rs:4
/// [mod]: index.html /// /// # 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 ont...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
fdde5583f853655fec57c44928b7d5f01621b754
github
async-runtime
https://github.com/tokio-rs/tokio/blob/fdde5583f853655fec57c44928b7d5f01621b754/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 blocking function onto the runtime using the handle /// handle.spawn_blocking(|| { /// println!("now running on a worker thread"); /// }); /// # } #[cfg_at...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
fdde5583f853655fec57c44928b7d5f01621b754
github
async-runtime
https://github.com/tokio-rs/tokio/blob/fdde5583f853655fec57c44928b7d5f01621b754/tokio/src/runtime/handle.rs
161
220
tokio-rs/tokio:tokio/src/runtime/handle.rs:6
let _ = self.blocking_spawner.spawn(task, &self); handle } } /// Error returned by `try_current` when no Runtime has been started pub struct TryCurrentError(()); impl fmt::Debug for TryCurrentError { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("TryCurrentError").f...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
fdde5583f853655fec57c44928b7d5f01621b754
github
async-runtime
https://github.com/tokio-rs/tokio/blob/fdde5583f853655fec57c44928b7d5f01621b754/tokio/src/runtime/handle.rs
201
221
tokio-rs/tokio:tokio/src/runtime/handle.rs:1
use crate::runtime::blocking::task::BlockingTask; use crate::runtime::task::{self, JoinHandle}; use crate::runtime::{blocking, context, driver, Spawner}; use std::future::Future; use std::{error, fmt}; /// Handle to the runtime. /// /// The handle is internally reference-counted and can be freely cloned. A handle can...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
ce0e9c67cfe61c7a91a284331ecc53fa01c32879
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ce0e9c67cfe61c7a91a284331ecc53fa01c32879/tokio/src/runtime/handle.rs
1
60
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 ha...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
ce0e9c67cfe61c7a91a284331ecc53fa01c32879
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ce0e9c67cfe61c7a91a284331ecc53fa01c32879/tokio/src/runtime/handle.rs
121
180
tokio-rs/tokio:tokio/src/runtime/handle.rs:5
/// // Get a handle from this runtime /// let handle = rt.handle(); /// /// // Spawn a blocking function onto the runtime using the handle /// handle.spawn_blocking(|| { /// println!("now running on a worker thread"); /// }); /// # } #[cfg_attr(tokio_track_caller, track_caller)] ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
ce0e9c67cfe61c7a91a284331ecc53fa01c32879
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ce0e9c67cfe61c7a91a284331ecc53fa01c32879/tokio/src/runtime/handle.rs
161
220
tokio-rs/tokio:tokio/src/runtime/handle.rs:6
handle } } /// Error returned by `try_current` when no Runtime has been started pub struct TryCurrentError(()); impl fmt::Debug for TryCurrentError { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("TryCurrentError").finish() } } impl fmt::Display for TryCurrentError { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
ce0e9c67cfe61c7a91a284331ecc53fa01c32879
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ce0e9c67cfe61c7a91a284331ecc53fa01c32879/tokio/src/runtime/handle.rs
201
220
tokio-rs/tokio:tokio/src/runtime/handle.rs:5
/// // Get a handle from this runtime /// let handle = rt.handle(); /// /// // Spawn a blocking function onto the runtime using the handle /// handle.spawn_blocking(|| { /// println!("now running on a worker thread"); /// }); /// # } #[cfg_attr(tokio_track_caller, track_caller)] ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
575938d4579e6fe6a89b700aadb0ae2bbab5483b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/575938d4579e6fe6a89b700aadb0ae2bbab5483b/tokio/src/runtime/handle.rs
161
220
tokio-rs/tokio:tokio/src/runtime/handle.rs:6
handle } } /// Error returned by `try_current` when no Runtime has been started #[non_exhaustive] pub struct TryCurrentError; impl fmt::Debug for TryCurrentError { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("TryCurrentError").finish() } } impl fmt::Display for TryCu...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
575938d4579e6fe6a89b700aadb0ae2bbab5483b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/575938d4579e6fe6a89b700aadb0ae2bbab5483b/tokio/src/runtime/handle.rs
201
221
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 ha...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
0b3918bce956567cccc617213a56c339a5a21d6f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0b3918bce956567cccc617213a56c339a5a21d6f/tokio/src/runtime/handle.rs
121
180
tokio-rs/tokio:tokio/src/runtime/handle.rs:5
/// // Get a handle from this runtime /// let handle = rt.handle(); /// /// // Spawn a blocking function onto the runtime using the handle /// handle.spawn_blocking(|| { /// println!("now running on a worker thread"); /// }); /// # } #[cfg_attr(tokio_track_caller, track_caller)] ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
0b3918bce956567cccc617213a56c339a5a21d6f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0b3918bce956567cccc617213a56c339a5a21d6f/tokio/src/runtime/handle.rs
161
220
tokio-rs/tokio:tokio/src/runtime/handle.rs:1
use crate::runtime::blocking::task::BlockingTask; use crate::runtime::task::{self, JoinHandle}; use crate::runtime::{blocking, driver, Spawner}; /// 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. ///...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
20a2b9e26316e704d16c62a28dfb74a505b92b25
github
async-runtime
https://github.com/tokio-rs/tokio/blob/20a2b9e26316e704d16c62a28dfb74a505b92b25/tokio/src/runtime/handle.rs
1
60
tokio-rs/tokio:tokio/src/runtime/handle.rs:2
/// Run the provided function on an executor dedicated to blocking /// operations. #[cfg_attr(tokio_track_caller, track_caller)] pub(crate) fn spawn_blocking<F, R>(&self, func: F) -> JoinHandle<R> where F: FnOnce() -> R + Send + 'static, R: Send + 'static, { #[cfg(feature = "...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
20a2b9e26316e704d16c62a28dfb74a505b92b25
github
async-runtime
https://github.com/tokio-rs/tokio/blob/20a2b9e26316e704d16c62a28dfb74a505b92b25/tokio/src/runtime/handle.rs
41
78
tokio-rs/tokio:tokio/src/runtime/handle.rs:1
use crate::runtime::blocking::task::BlockingTask; use crate::runtime::task::{self, JoinHandle}; use crate::runtime::{blocking, driver, Spawner}; /// 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. ///...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
fede3db76aef95c010c3e0c3da3b732380285097
github
async-runtime
https://github.com/tokio-rs/tokio/blob/fede3db76aef95c010c3e0c3da3b732380285097/tokio/src/runtime/handle.rs
1
60
tokio-rs/tokio:tokio/src/runtime/handle.rs:2
/// Run the provided function on an executor dedicated to blocking /// operations. #[cfg_attr(tokio_track_caller, track_caller)] pub(crate) fn spawn_blocking<F, R>(&self, func: F) -> JoinHandle<R> where F: FnOnce() -> R + Send + 'static, { #[cfg(feature = "tracing")] let func...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
fede3db76aef95c010c3e0c3da3b732380285097
github
async-runtime
https://github.com/tokio-rs/tokio/blob/fede3db76aef95c010c3e0c3da3b732380285097/tokio/src/runtime/handle.rs
41
77
tokio-rs/tokio:tokio/src/runtime/handle.rs:1
use crate::runtime::blocking::task::BlockingTask; use crate::runtime::task::{self, JoinHandle}; use crate::runtime::{blocking, driver, Spawner}; /// 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. ///...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/handle.rs
MIT
7fbfa9b649b16de6096eb673f8debfb900618987
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7fbfa9b649b16de6096eb673f8debfb900618987/tokio/src/runtime/handle.rs
1
60