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/task/join_set.rs:11
impl<'a, T: 'static> Builder<'a, T> { /// Assigns a name to the task which will be spawned. pub fn name(self, name: &'a str) -> Self { let builder = self.builder.name(name); Self { builder, ..self } } /// Spawn the provided task with this builder's settings and store it in the /// [...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/join_set.rs
MIT
b67b8c1398ddeb8c434e39595b1a48c5a2dddbbe
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b67b8c1398ddeb8c434e39595b1a48c5a2dddbbe/tokio/src/task/join_set.rs
401
460
tokio-rs/tokio:tokio/src/task/join_set.rs:12
#[track_caller] pub fn spawn_on<F>(mut self, future: F, handle: &Handle) -> std::io::Result<AbortHandle> where F: Future<Output = T>, F: Send + 'static, T: Send, { Ok(self.joinset.insert(self.builder.spawn_on(future, handle)?)) } /// Spawn the provided task on the cu...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/join_set.rs
MIT
b67b8c1398ddeb8c434e39595b1a48c5a2dddbbe
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b67b8c1398ddeb8c434e39595b1a48c5a2dddbbe/tokio/src/task/join_set.rs
441
500
tokio-rs/tokio:tokio/src/task/join_set.rs:2
/// for i in 0..10 { /// set.spawn(async move { i }); /// } /// /// let mut seen = [false; 10]; /// while let Some(res) = set.join_next().await { /// let idx = res.unwrap(); /// seen[idx] = true; /// } /// /// for i in 0..10 { /// assert!(seen[i]); /// } /// }...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/join_set.rs
MIT
3b6c74a40ad87837ab53c105a323c2807a4e1b38
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3b6c74a40ad87837ab53c105a323c2807a4e1b38/tokio/src/task/join_set.rs
41
100
tokio-rs/tokio:tokio/src/task/join_set.rs:3
} /// Returns the number of tasks currently in the `JoinSet`. pub fn len(&self) -> usize { self.inner.len() } /// Returns whether the `JoinSet` is empty. pub fn is_empty(&self) -> bool { self.inner.is_empty() } } impl<T: 'static> JoinSet<T> { /// Returns a [`Builder`] that...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/join_set.rs
MIT
3b6c74a40ad87837ab53c105a323c2807a4e1b38
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3b6c74a40ad87837ab53c105a323c2807a4e1b38/tokio/src/task/join_set.rs
81
140
tokio-rs/tokio:tokio/src/task/join_set.rs:4
} } /// Spawn the provided task on the `JoinSet`, returning an [`AbortHandle`] /// that can be used to remotely cancel the task. /// /// # Panics /// /// This method panics if called outside of a Tokio runtime. /// /// [`AbortHandle`]: crate::task::AbortHandle #[track_caller] ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/join_set.rs
MIT
3b6c74a40ad87837ab53c105a323c2807a4e1b38
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3b6c74a40ad87837ab53c105a323c2807a4e1b38/tokio/src/task/join_set.rs
121
180
tokio-rs/tokio:tokio/src/task/join_set.rs:5
/// # Panics /// /// This method panics if it is called outside of a `LocalSet`. /// /// [`LocalSet`]: crate::task::LocalSet /// [`AbortHandle`]: crate::task::AbortHandle #[track_caller] pub fn spawn_local<F>(&mut self, task: F) -> AbortHandle where F: Future<Output = T>, ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/join_set.rs
MIT
3b6c74a40ad87837ab53c105a323c2807a4e1b38
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3b6c74a40ad87837ab53c105a323c2807a4e1b38/tokio/src/task/join_set.rs
161
220
tokio-rs/tokio:tokio/src/task/join_set.rs:6
#[deprecated(since = "1.20.0", note = "renamed to `JoinSet::join_next`.")] pub async fn join_one(&mut self) -> Option<Result<T, JoinError>> { self.join_next().await } /// Waits until one of the tasks in the set completes and returns its output. /// /// Returns `None` if the set is empty. ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/join_set.rs
MIT
3b6c74a40ad87837ab53c105a323c2807a4e1b38
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3b6c74a40ad87837ab53c105a323c2807a4e1b38/tokio/src/task/join_set.rs
201
260
tokio-rs/tokio:tokio/src/task/join_set.rs:7
} #[doc(hidden)] #[deprecated(since = "1.20.0", note = "renamed to `JoinSet::join_next_with_id`")] pub async fn join_one_with_id(&mut self) -> Option<Result<(Id, T), JoinError>> { self.join_next_with_id().await } /// Aborts all tasks and waits for them to finish shutting down. /// ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/join_set.rs
MIT
3b6c74a40ad87837ab53c105a323c2807a4e1b38
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3b6c74a40ad87837ab53c105a323c2807a4e1b38/tokio/src/task/join_set.rs
241
300
tokio-rs/tokio:tokio/src/task/join_set.rs:8
/// /// If this returns `Poll::Ready(Some(_))`, then the task that completed is removed from the set. /// /// When the method returns `Poll::Pending`, the `Waker` in the provided `Context` is scheduled /// to receive a wakeup when a task in the `JoinSet` completes. Note that on multiple calls to ///...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/join_set.rs
MIT
3b6c74a40ad87837ab53c105a323c2807a4e1b38
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3b6c74a40ad87837ab53c105a323c2807a4e1b38/tokio/src/task/join_set.rs
281
340
tokio-rs/tokio:tokio/src/task/join_set.rs:3
} /// Returns the number of tasks currently in the `JoinSet`. pub fn len(&self) -> usize { self.inner.len() } /// Returns whether the `JoinSet` is empty. pub fn is_empty(&self) -> bool { self.inner.is_empty() } } impl<T: 'static> JoinSet<T> { /// Returns a [`Builder`] that...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/join_set.rs
MIT
08d49532b4179d9209a92a5a4c425e63d76218fe
github
async-runtime
https://github.com/tokio-rs/tokio/blob/08d49532b4179d9209a92a5a4c425e63d76218fe/tokio/src/task/join_set.rs
81
140
tokio-rs/tokio:tokio/src/task/join_set.rs:4
/// Spawn the provided task on the `JoinSet`, returning an [`AbortHandle`] /// that can be used to remotely cancel the task. /// /// # Panics /// /// This method panics if called outside of a Tokio runtime. /// /// [`AbortHandle`]: crate::task::AbortHandle #[track_caller] pub fn spaw...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/join_set.rs
MIT
08d49532b4179d9209a92a5a4c425e63d76218fe
github
async-runtime
https://github.com/tokio-rs/tokio/blob/08d49532b4179d9209a92a5a4c425e63d76218fe/tokio/src/task/join_set.rs
121
180
tokio-rs/tokio:tokio/src/task/join_set.rs:5
/// This method panics if it is called outside of a `LocalSet`. /// /// [`LocalSet`]: crate::task::LocalSet /// [`AbortHandle`]: crate::task::AbortHandle #[track_caller] pub fn spawn_local<F>(&mut self, task: F) -> AbortHandle where F: Future<Output = T>, F: 'static, { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/join_set.rs
MIT
08d49532b4179d9209a92a5a4c425e63d76218fe
github
async-runtime
https://github.com/tokio-rs/tokio/blob/08d49532b4179d9209a92a5a4c425e63d76218fe/tokio/src/task/join_set.rs
161
220
tokio-rs/tokio:tokio/src/task/join_set.rs:6
self.join_next().await } /// Waits until one of the tasks in the set completes and returns its output. /// /// Returns `None` if the set is empty. /// /// # Cancel Safety /// /// This method is cancel safe. If `join_next` is used as the event in a `tokio::select!` /// statement and ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/join_set.rs
MIT
08d49532b4179d9209a92a5a4c425e63d76218fe
github
async-runtime
https://github.com/tokio-rs/tokio/blob/08d49532b4179d9209a92a5a4c425e63d76218fe/tokio/src/task/join_set.rs
201
260
tokio-rs/tokio:tokio/src/task/join_set.rs:7
#[doc(hidden)] #[deprecated(since = "1.20.0", note = "renamed to `JoinSet::join_next_with_id`")] pub async fn join_one_with_id(&mut self) -> Option<Result<(Id, T), JoinError>> { self.join_next_with_id().await } /// Aborts all tasks and waits for them to finish shutting down. /// /// Cal...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/join_set.rs
MIT
08d49532b4179d9209a92a5a4c425e63d76218fe
github
async-runtime
https://github.com/tokio-rs/tokio/blob/08d49532b4179d9209a92a5a4c425e63d76218fe/tokio/src/task/join_set.rs
241
300
tokio-rs/tokio:tokio/src/task/join_set.rs:8
/// /// When the method returns `Poll::Pending`, the `Waker` in the provided `Context` is scheduled /// to receive a wakeup when a task in the `JoinSet` completes. Note that on multiple calls to /// `poll_join_next`, only the `Waker` from the `Context` passed to the most recent call is /// scheduled to ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/join_set.rs
MIT
08d49532b4179d9209a92a5a4c425e63d76218fe
github
async-runtime
https://github.com/tokio-rs/tokio/blob/08d49532b4179d9209a92a5a4c425e63d76218fe/tokio/src/task/join_set.rs
281
340
tokio-rs/tokio:tokio/src/task/join_set.rs:9
if let Poll::Ready(res) = res { let entry = entry.remove(); // If the task succeeded, add the task ID to the output. Otherwise, the // `JoinError` will already have the task's ID. Poll::Ready(Some(res.map(|output| (entry.id(), output)))) } else { // A ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/join_set.rs
MIT
08d49532b4179d9209a92a5a4c425e63d76218fe
github
async-runtime
https://github.com/tokio-rs/tokio/blob/08d49532b4179d9209a92a5a4c425e63d76218fe/tokio/src/task/join_set.rs
321
380
tokio-rs/tokio:tokio/src/task/join_set.rs:10
pub fn name(self, name: &'a str) -> Self { let builder = self.builder.name(name); Self { builder, ..self } } /// Spawn the provided task with this builder's settings and store it in the /// [`JoinSet`], returning an [`AbortHandle`] that can be used to remotely /// cancel the task. /...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/join_set.rs
MIT
08d49532b4179d9209a92a5a4c425e63d76218fe
github
async-runtime
https://github.com/tokio-rs/tokio/blob/08d49532b4179d9209a92a5a4c425e63d76218fe/tokio/src/task/join_set.rs
361
420
tokio-rs/tokio:tokio/src/task/join_set.rs:11
where F: Future<Output = T>, F: Send + 'static, T: Send, { self.joinset.insert(self.builder.spawn_on(future, handle)) } /// Spawn the provided task on the current [`LocalSet`] with this builder's /// settings, and store it in the [`JoinSet`]. /// /// # Returns ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/join_set.rs
MIT
08d49532b4179d9209a92a5a4c425e63d76218fe
github
async-runtime
https://github.com/tokio-rs/tokio/blob/08d49532b4179d9209a92a5a4c425e63d76218fe/tokio/src/task/join_set.rs
401
460
tokio-rs/tokio:tokio/src/task/join_set.rs:12
pub fn spawn_local_on<F>(self, future: F, local_set: &LocalSet) -> AbortHandle where F: Future<Output = T>, F: 'static, { self.joinset .insert(self.builder.spawn_local_on(future, local_set)) } } // Manual `Debug` impl so that `Builder` is `Debug` regardless of whether `T...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/join_set.rs
MIT
08d49532b4179d9209a92a5a4c425e63d76218fe
github
async-runtime
https://github.com/tokio-rs/tokio/blob/08d49532b4179d9209a92a5a4c425e63d76218fe/tokio/src/task/join_set.rs
441
462
tokio-rs/tokio:tokio/src/task/join_set.rs:2
/// for i in 0..10 { /// set.spawn(async move { i }); /// } /// /// let mut seen = [false; 10]; /// while let Some(res) = set.join_one().await { /// let idx = res.unwrap(); /// seen[idx] = true; /// } /// /// for i in 0..10 { /// assert!(seen[i]); /// } /// } ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/join_set.rs
MIT
5fd1220c7302ec2291699939a8f6cda210ef7bae
github
async-runtime
https://github.com/tokio-rs/tokio/blob/5fd1220c7302ec2291699939a8f6cda210ef7bae/tokio/src/task/join_set.rs
41
100
tokio-rs/tokio:tokio/src/task/join_set.rs:5
/// This method panics if it is called outside of a `LocalSet`. /// /// [`LocalSet`]: crate::task::LocalSet /// [`AbortHandle`]: crate::task::AbortHandle #[track_caller] pub fn spawn_local<F>(&mut self, task: F) -> AbortHandle where F: Future<Output = T>, F: 'static, { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/join_set.rs
MIT
5fd1220c7302ec2291699939a8f6cda210ef7bae
github
async-runtime
https://github.com/tokio-rs/tokio/blob/5fd1220c7302ec2291699939a8f6cda210ef7bae/tokio/src/task/join_set.rs
161
220
tokio-rs/tokio:tokio/src/task/join_set.rs:6
/// /// # Cancel Safety /// /// This method is cancel safe. If `join_one` is used as the event in a `tokio::select!` /// statement and some other branch completes first, it is guaranteed that no tasks were /// removed from this `JoinSet`. pub async fn join_one(&mut self) -> Option<Result<T, Join...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/join_set.rs
MIT
5fd1220c7302ec2291699939a8f6cda210ef7bae
github
async-runtime
https://github.com/tokio-rs/tokio/blob/5fd1220c7302ec2291699939a8f6cda210ef7bae/tokio/src/task/join_set.rs
201
260
tokio-rs/tokio:tokio/src/task/join_set.rs:7
/// [`abort_all`]: fn@Self::abort_all /// [`join_one`]: fn@Self::join_one pub async fn shutdown(&mut self) { self.abort_all(); while self.join_one().await.is_some() {} } /// Aborts all tasks on this `JoinSet`. /// /// This does not remove the tasks from the `JoinSet`. To wait fo...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/join_set.rs
MIT
5fd1220c7302ec2291699939a8f6cda210ef7bae
github
async-runtime
https://github.com/tokio-rs/tokio/blob/5fd1220c7302ec2291699939a8f6cda210ef7bae/tokio/src/task/join_set.rs
241
300
tokio-rs/tokio:tokio/src/task/join_set.rs:8
/// `id` is the [task ID] of that task. /// * `Poll::Ready(Some(Err(err)))` if one of the tasks in this `JoinSet` has panicked or been /// aborted. The `err` is the `JoinError` from the panicked/aborted task. /// * `Poll::Ready(None)` if the `JoinSet` is empty. /// /// Note that this method...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/join_set.rs
MIT
5fd1220c7302ec2291699939a8f6cda210ef7bae
github
async-runtime
https://github.com/tokio-rs/tokio/blob/5fd1220c7302ec2291699939a8f6cda210ef7bae/tokio/src/task/join_set.rs
281
340
tokio-rs/tokio:tokio/src/task/join_set.rs:9
} impl<T> Drop for JoinSet<T> { fn drop(&mut self) { self.inner.drain(|join_handle| join_handle.abort()); } } impl<T> fmt::Debug for JoinSet<T> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("JoinSet").field("len", &self.len()).finish() } } impl<T> Default...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/join_set.rs
MIT
5fd1220c7302ec2291699939a8f6cda210ef7bae
github
async-runtime
https://github.com/tokio-rs/tokio/blob/5fd1220c7302ec2291699939a8f6cda210ef7bae/tokio/src/task/join_set.rs
321
380
tokio-rs/tokio:tokio/src/task/join_set.rs:10
/// /// This method panics if called outside of a Tokio runtime. /// /// [`AbortHandle`]: crate::task::AbortHandle #[track_caller] pub fn spawn<F>(self, future: F) -> AbortHandle where F: Future<Output = T>, F: Send + 'static, T: Send, { self.joinset.insert(se...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/join_set.rs
MIT
5fd1220c7302ec2291699939a8f6cda210ef7bae
github
async-runtime
https://github.com/tokio-rs/tokio/blob/5fd1220c7302ec2291699939a8f6cda210ef7bae/tokio/src/task/join_set.rs
361
420
tokio-rs/tokio:tokio/src/task/join_set.rs:11
/// /// # Panics /// /// This method panics if it is called outside of a `LocalSet`. /// /// [`LocalSet`]: crate::task::LocalSet /// [`AbortHandle`]: crate::task::AbortHandle #[track_caller] pub fn spawn_local<F>(self, future: F) -> AbortHandle where F: Future<Output = T>, ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/join_set.rs
MIT
5fd1220c7302ec2291699939a8f6cda210ef7bae
github
async-runtime
https://github.com/tokio-rs/tokio/blob/5fd1220c7302ec2291699939a8f6cda210ef7bae/tokio/src/task/join_set.rs
401
448
tokio-rs/tokio:tokio/src/task/join_set.rs:2
/// for i in 0..10 { /// set.spawn(async move { i }); /// } /// /// let mut seen = [false; 10]; /// while let Some(res) = set.join_one().await.unwrap() { /// seen[res] = true; /// } /// /// for i in 0..10 { /// assert!(seen[i]); /// } /// } /// ``` /// /// [unstable]:...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/join_set.rs
MIT
2bad98f879811760922818807157b173e58625d1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2bad98f879811760922818807157b173e58625d1/tokio/src/task/join_set.rs
41
100
tokio-rs/tokio:tokio/src/task/join_set.rs:3
/// Returns the number of tasks currently in the `JoinSet`. pub fn len(&self) -> usize { self.inner.len() } /// Returns whether the `JoinSet` is empty. pub fn is_empty(&self) -> bool { self.inner.is_empty() } } impl<T: 'static> JoinSet<T> { /// Returns a [`Builder`] that can be...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/join_set.rs
MIT
2bad98f879811760922818807157b173e58625d1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2bad98f879811760922818807157b173e58625d1/tokio/src/task/join_set.rs
81
140
tokio-rs/tokio:tokio/src/task/join_set.rs:4
/// Spawn the provided task on the `JoinSet`, returning an [`AbortHandle`] /// that can be used to remotely cancel the task. /// /// # Panics /// /// This method panics if called outside of a Tokio runtime. /// /// [`AbortHandle`]: crate::task::AbortHandle #[track_caller] pub fn spaw...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/join_set.rs
MIT
2bad98f879811760922818807157b173e58625d1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2bad98f879811760922818807157b173e58625d1/tokio/src/task/join_set.rs
121
180
tokio-rs/tokio:tokio/src/task/join_set.rs:5
/// /// [`LocalSet`]: crate::task::LocalSet /// [`AbortHandle`]: crate::task::AbortHandle #[track_caller] pub fn spawn_local<F>(&mut self, task: F) -> AbortHandle where F: Future<Output = T>, F: 'static, { self.insert(crate::task::spawn_local(task)) } /// Spawn t...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/join_set.rs
MIT
2bad98f879811760922818807157b173e58625d1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2bad98f879811760922818807157b173e58625d1/tokio/src/task/join_set.rs
161
220
tokio-rs/tokio:tokio/src/task/join_set.rs:6
/// # Cancel Safety /// /// This method is cancel safe. If `join_one` is used as the event in a `tokio::select!` /// statement and some other branch completes first, it is guaranteed that no tasks were /// removed from this `JoinSet`. pub async fn join_one(&mut self) -> Result<Option<T>, JoinError> ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/join_set.rs
MIT
2bad98f879811760922818807157b173e58625d1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2bad98f879811760922818807157b173e58625d1/tokio/src/task/join_set.rs
201
260
tokio-rs/tokio:tokio/src/task/join_set.rs:7
} /// Aborts all tasks on this `JoinSet`. /// /// This does not remove the tasks from the `JoinSet`. To wait for the tasks to complete /// cancellation, you should call `join_one` in a loop until the `JoinSet` is empty. pub fn abort_all(&mut self) { self.inner.for_each(|jh| jh.abort()); ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/join_set.rs
MIT
2bad98f879811760922818807157b173e58625d1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2bad98f879811760922818807157b173e58625d1/tokio/src/task/join_set.rs
241
300
tokio-rs/tokio:tokio/src/task/join_set.rs:8
/// /// Note that this method may return `Poll::Pending` even if one of the tasks has completed. /// This can happen if the [coop budget] is reached. /// /// [coop budget]: crate::task#cooperative-scheduling /// [task ID]: crate::task::Id fn poll_join_one(&mut self, cx: &mut Context<'_>) -> Poll...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/join_set.rs
MIT
2bad98f879811760922818807157b173e58625d1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2bad98f879811760922818807157b173e58625d1/tokio/src/task/join_set.rs
281
340
tokio-rs/tokio:tokio/src/task/join_set.rs:9
fn drop(&mut self) { self.inner.drain(|join_handle| join_handle.abort()); } } impl<T> fmt::Debug for JoinSet<T> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("JoinSet").field("len", &self.len()).finish() } } impl<T> Default for JoinSet<T> { fn default() ->...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/join_set.rs
MIT
2bad98f879811760922818807157b173e58625d1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2bad98f879811760922818807157b173e58625d1/tokio/src/task/join_set.rs
321
380
tokio-rs/tokio:tokio/src/task/join_set.rs:10
/// [`AbortHandle`]: crate::task::AbortHandle #[track_caller] pub fn spawn<F>(self, future: F) -> AbortHandle where F: Future<Output = T>, F: Send + 'static, T: Send, { self.joinset.insert(self.builder.spawn(future)) } /// Spawn the provided task on the provided ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/join_set.rs
MIT
2bad98f879811760922818807157b173e58625d1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2bad98f879811760922818807157b173e58625d1/tokio/src/task/join_set.rs
361
420
tokio-rs/tokio:tokio/src/task/join_set.rs:11
/// This method panics if it is called outside of a `LocalSet`. /// /// [`LocalSet`]: crate::task::LocalSet /// [`AbortHandle`]: crate::task::AbortHandle #[track_caller] pub fn spawn_local<F>(self, future: F) -> AbortHandle where F: Future<Output = T>, F: 'static, { s...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/join_set.rs
MIT
2bad98f879811760922818807157b173e58625d1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2bad98f879811760922818807157b173e58625d1/tokio/src/task/join_set.rs
401
445
tokio-rs/tokio:tokio/src/task/join_set.rs:1
use std::fmt; use std::future::Future; use std::pin::Pin; use std::task::{Context, Poll}; use crate::runtime::Handle; use crate::task::{AbortHandle, Id, JoinError, JoinHandle, LocalSet}; use crate::util::IdleNotifiedSet; /// A collection of tasks spawned on a Tokio runtime. /// /// A `JoinSet` can be used to await th...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/join_set.rs
MIT
052355f0649bf54ee1850060a636d045eb7e2bf1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/052355f0649bf54ee1850060a636d045eb7e2bf1/tokio/src/task/join_set.rs
1
60
tokio-rs/tokio:tokio/src/task/join_set.rs:2
/// seen[res] = true; /// } /// /// for i in 0..10 { /// assert!(seen[i]); /// } /// } /// ``` /// /// [unstable]: crate#unstable-features #[cfg_attr(docsrs, doc(cfg(all(feature = "rt", tokio_unstable))))] pub struct JoinSet<T> { inner: IdleNotifiedSet<JoinHandle<T>>, } impl<T> JoinSet<...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/join_set.rs
MIT
052355f0649bf54ee1850060a636d045eb7e2bf1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/052355f0649bf54ee1850060a636d045eb7e2bf1/tokio/src/task/join_set.rs
41
100
tokio-rs/tokio:tokio/src/task/join_set.rs:3
/// This method panics if called outside of a Tokio runtime. /// /// [`AbortHandle`]: crate::task::AbortHandle #[track_caller] pub fn spawn<F>(&mut self, task: F) -> AbortHandle where F: Future<Output = T>, F: Send + 'static, T: Send, { self.insert(crate::spawn(ta...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/join_set.rs
MIT
052355f0649bf54ee1850060a636d045eb7e2bf1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/052355f0649bf54ee1850060a636d045eb7e2bf1/tokio/src/task/join_set.rs
81
140
tokio-rs/tokio:tokio/src/task/join_set.rs:4
where F: Future<Output = T>, F: 'static, { self.insert(crate::task::spawn_local(task)) } /// Spawn the provided task on the provided [`LocalSet`] and store it in /// this `JoinSet`, returning an [`AbortHandle`] that can be used to /// remotely cancel the task. /// //...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/join_set.rs
MIT
052355f0649bf54ee1850060a636d045eb7e2bf1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/052355f0649bf54ee1850060a636d045eb7e2bf1/tokio/src/task/join_set.rs
121
180
tokio-rs/tokio:tokio/src/task/join_set.rs:5
pub async fn join_one(&mut self) -> Result<Option<T>, JoinError> { crate::future::poll_fn(|cx| self.poll_join_one(cx)) .await .map(|opt| opt.map(|(_, res)| res)) } /// Waits until one of the tasks in the set completes and returns its /// output, along with the [task ID] of t...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/join_set.rs
MIT
052355f0649bf54ee1850060a636d045eb7e2bf1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/052355f0649bf54ee1850060a636d045eb7e2bf1/tokio/src/task/join_set.rs
161
220
tokio-rs/tokio:tokio/src/task/join_set.rs:6
/// cancellation, you should call `join_one` in a loop until the `JoinSet` is empty. pub fn abort_all(&mut self) { self.inner.for_each(|jh| jh.abort()); } /// Removes all tasks from this `JoinSet` without aborting them. /// /// The tasks removed by this call will continue to run in the back...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/join_set.rs
MIT
052355f0649bf54ee1850060a636d045eb7e2bf1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/052355f0649bf54ee1850060a636d045eb7e2bf1/tokio/src/task/join_set.rs
201
260
tokio-rs/tokio:tokio/src/task/join_set.rs:7
/// [task ID]: crate::task::Id fn poll_join_one(&mut self, cx: &mut Context<'_>) -> Poll<Result<Option<(Id, T)>, JoinError>> { // The call to `pop_notified` moves the entry to the `idle` list. It is moved back to // the `notified` list if the waker is notified in the `poll` call below. let m...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/join_set.rs
MIT
052355f0649bf54ee1850060a636d045eb7e2bf1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/052355f0649bf54ee1850060a636d045eb7e2bf1/tokio/src/task/join_set.rs
241
291
tokio-rs/tokio:tokio/src/task/join_set.rs:8
impl<T> fmt::Debug for JoinSet<T> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("JoinSet").field("len", &self.len()).finish() } } impl<T> Default for JoinSet<T> { fn default() -> Self { Self::new() } }
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/join_set.rs
MIT
052355f0649bf54ee1850060a636d045eb7e2bf1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/052355f0649bf54ee1850060a636d045eb7e2bf1/tokio/src/task/join_set.rs
281
291
tokio-rs/tokio:tokio/src/task/join_set.rs:2
/// seen[res] = true; /// } /// /// for i in 0..10 { /// assert!(seen[i]); /// } /// } /// ``` /// /// [unstable]: crate#unstable-features #[cfg_attr(docsrs, doc(cfg(all(feature = "rt", tokio_unstable))))] pub struct JoinSet<T> { inner: IdleNotifiedSet<JoinHandle<T>>, } impl<T> JoinSet<...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/join_set.rs
MIT
1d3f12304e29dbb8fe3ef4089d01d5acb9edaae1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1d3f12304e29dbb8fe3ef4089d01d5acb9edaae1/tokio/src/task/join_set.rs
41
100
tokio-rs/tokio:tokio/src/task/join_set.rs:3
/// This method panics if called outside of a Tokio runtime. /// /// [`AbortHandle`]: crate::task::AbortHandle pub fn spawn<F>(&mut self, task: F) -> AbortHandle where F: Future<Output = T>, F: Send + 'static, T: Send, { self.insert(crate::spawn(task)) } /// ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/join_set.rs
MIT
1d3f12304e29dbb8fe3ef4089d01d5acb9edaae1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1d3f12304e29dbb8fe3ef4089d01d5acb9edaae1/tokio/src/task/join_set.rs
81
140
tokio-rs/tokio:tokio/src/task/join_set.rs:4
{ self.insert(crate::task::spawn_local(task)) } /// Spawn the provided task on the provided [`LocalSet`] and store it in /// this `JoinSet`, returning an [`AbortHandle`] that can be used to /// remotely cancel the task. /// /// [`LocalSet`]: crate::task::LocalSet /// [`AbortHandle`]...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/join_set.rs
MIT
1d3f12304e29dbb8fe3ef4089d01d5acb9edaae1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1d3f12304e29dbb8fe3ef4089d01d5acb9edaae1/tokio/src/task/join_set.rs
121
180
tokio-rs/tokio:tokio/src/task/join_set.rs:5
} /// Waits until one of the tasks in the set completes and returns its /// output, along with the [task ID] of the completed task. /// /// Returns `None` if the set is empty. /// /// # Cancel Safety /// /// This method is cancel safe. If `join_one_with_id` is used as the event in a `to...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/join_set.rs
MIT
1d3f12304e29dbb8fe3ef4089d01d5acb9edaae1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1d3f12304e29dbb8fe3ef4089d01d5acb9edaae1/tokio/src/task/join_set.rs
161
220
tokio-rs/tokio:tokio/src/task/join_set.rs:6
/// Removes all tasks from this `JoinSet` without aborting them. /// /// The tasks removed by this call will continue to run in the background even if the `JoinSet` /// is dropped. pub fn detach_all(&mut self) { self.inner.drain(drop); } /// Polls for one of the tasks in the set to comp...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/join_set.rs
MIT
1d3f12304e29dbb8fe3ef4089d01d5acb9edaae1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1d3f12304e29dbb8fe3ef4089d01d5acb9edaae1/tokio/src/task/join_set.rs
201
260
tokio-rs/tokio:tokio/src/task/join_set.rs:7
let mut entry = match self.inner.pop_notified(cx.waker()) { Some(entry) => entry, None => { if self.is_empty() { return Poll::Ready(Ok(None)); } else { // The waker was set by `pop_notified`. return Poll:...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/join_set.rs
MIT
1d3f12304e29dbb8fe3ef4089d01d5acb9edaae1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1d3f12304e29dbb8fe3ef4089d01d5acb9edaae1/tokio/src/task/join_set.rs
241
287
tokio-rs/tokio:tokio/src/task/join_set.rs:1
use std::fmt; use std::future::Future; use std::pin::Pin; use std::task::{Context, Poll}; use crate::runtime::Handle; use crate::task::{AbortHandle, JoinError, JoinHandle, LocalSet}; use crate::util::IdleNotifiedSet; /// A collection of tasks spawned on a Tokio runtime. /// /// A `JoinSet` can be used to await the co...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/join_set.rs
MIT
8e0e56fdf23da0ad807c78ac57a19db939666253
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8e0e56fdf23da0ad807c78ac57a19db939666253/tokio/src/task/join_set.rs
1
60
tokio-rs/tokio:tokio/src/task/join_set.rs:4
{ self.insert(crate::task::spawn_local(task)) } /// Spawn the provided task on the provided [`LocalSet`] and store it in /// this `JoinSet`, returning an [`AbortHandle`] that can be used to /// remotely cancel the task. /// /// [`LocalSet`]: crate::task::LocalSet /// [`AbortHandle`]...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/join_set.rs
MIT
8e0e56fdf23da0ad807c78ac57a19db939666253
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8e0e56fdf23da0ad807c78ac57a19db939666253/tokio/src/task/join_set.rs
121
180
tokio-rs/tokio:tokio/src/task/join_set.rs:6
/// /// # Returns /// /// This function returns: /// /// * `Poll::Pending` if the `JoinSet` is not empty but there is no task whose output is /// available right now. /// * `Poll::Ready(Ok(Some(value)))` if one of the tasks in this `JoinSet` has completed. The /// `value` is the...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/join_set.rs
MIT
8e0e56fdf23da0ad807c78ac57a19db939666253
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8e0e56fdf23da0ad807c78ac57a19db939666253/tokio/src/task/join_set.rs
201
260
tokio-rs/tokio:tokio/src/task/join_set.rs:7
// case. cx.waker().wake_by_ref(); Poll::Pending } } } impl<T> Drop for JoinSet<T> { fn drop(&mut self) { self.inner.drain(|join_handle| join_handle.abort()); } } impl<T> fmt::Debug for JoinSet<T> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/join_set.rs
MIT
8e0e56fdf23da0ad807c78ac57a19db939666253
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8e0e56fdf23da0ad807c78ac57a19db939666253/tokio/src/task/join_set.rs
241
264
tokio-rs/tokio:tokio/src/task/join_set.rs:1
use std::fmt; use std::future::Future; use std::pin::Pin; use std::task::{Context, Poll}; use crate::runtime::Handle; use crate::task::{JoinError, JoinHandle, LocalSet}; use crate::util::IdleNotifiedSet; /// A collection of tasks spawned on a Tokio runtime. /// /// A `JoinSet` can be used to await the completion of s...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/join_set.rs
MIT
0b97567b498855aafbd583af00c94aea24fd9fda
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0b97567b498855aafbd583af00c94aea24fd9fda/tokio/src/task/join_set.rs
1
60
tokio-rs/tokio:tokio/src/task/join_set.rs:2
/// seen[res] = true; /// } /// /// for i in 0..10 { /// assert!(seen[i]); /// } /// } /// ``` /// /// [unstable]: crate#unstable-features #[cfg_attr(docsrs, doc(cfg(all(feature = "rt", tokio_unstable))))] pub struct JoinSet<T> { inner: IdleNotifiedSet<JoinHandle<T>>, } impl<T> JoinSet<...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/join_set.rs
MIT
0b97567b498855aafbd583af00c94aea24fd9fda
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0b97567b498855aafbd583af00c94aea24fd9fda/tokio/src/task/join_set.rs
41
100
tokio-rs/tokio:tokio/src/task/join_set.rs:3
pub fn spawn<F>(&mut self, task: F) where F: Future<Output = T>, F: Send + 'static, T: Send, { self.insert(crate::spawn(task)); } /// Spawn the provided task on the provided runtime and store it in this `JoinSet`. pub fn spawn_on<F>(&mut self, task: F, handle: &Handl...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/join_set.rs
MIT
0b97567b498855aafbd583af00c94aea24fd9fda
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0b97567b498855aafbd583af00c94aea24fd9fda/tokio/src/task/join_set.rs
81
140
tokio-rs/tokio:tokio/src/task/join_set.rs:4
F: 'static, { self.insert(local_set.spawn_local(task)); } fn insert(&mut self, jh: JoinHandle<T>) { let mut entry = self.inner.insert_idle(jh); // Set the waker that is notified when the task completes. entry.with_value_and_context(|jh, ctx| jh.set_join_waker(ctx.waker()));...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/join_set.rs
MIT
0b97567b498855aafbd583af00c94aea24fd9fda
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0b97567b498855aafbd583af00c94aea24fd9fda/tokio/src/task/join_set.rs
121
180
tokio-rs/tokio:tokio/src/task/join_set.rs:5
/// Aborts all tasks on this `JoinSet`. /// /// This does not remove the tasks from the `JoinSet`. To wait for the tasks to complete /// cancellation, you should call `join_one` in a loop until the `JoinSet` is empty. pub fn abort_all(&mut self) { self.inner.for_each(|jh| jh.abort()); } ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/join_set.rs
MIT
0b97567b498855aafbd583af00c94aea24fd9fda
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0b97567b498855aafbd583af00c94aea24fd9fda/tokio/src/task/join_set.rs
161
220
tokio-rs/tokio:tokio/src/task/join_set.rs:6
/// /// [coop budget]: crate::task#cooperative-scheduling fn poll_join_one(&mut self, cx: &mut Context<'_>) -> Poll<Result<Option<T>, JoinError>> { // The call to `pop_notified` moves the entry to the `idle` list. It is moved back to // the `notified` list if the waker is notified in the `poll` ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/join_set.rs
MIT
0b97567b498855aafbd583af00c94aea24fd9fda
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0b97567b498855aafbd583af00c94aea24fd9fda/tokio/src/task/join_set.rs
201
249
tokio-rs/tokio:tokio/src/task/join_set.rs:1
use std::fmt; use std::future::Future; use std::pin::Pin; use std::task::{Context, Poll}; use crate::runtime::Handle; use crate::task::{JoinError, JoinHandle, LocalSet}; use crate::util::IdleNotifiedSet; /// A collection of tasks spawned on a Tokio runtime. /// /// A `JoinSet` can be used to await the completion of s...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/join_set.rs
MIT
8758965206d3c23c07ded0518d6c7398043ef227
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8758965206d3c23c07ded0518d6c7398043ef227/tokio/src/task/join_set.rs
1
60
tokio-rs/tokio:tokio/src/task/join_set.rs:2
/// seen[res] = true; /// } /// /// for i in 0..10 { /// assert!(seen[i]); /// } /// } /// ``` /// /// [unstable]: crate#unstable-features pub struct JoinSet<T> { inner: IdleNotifiedSet<JoinHandle<T>>, } impl<T> JoinSet<T> { /// Create a new `JoinSet`. pub fn new() -> Self { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/join_set.rs
MIT
8758965206d3c23c07ded0518d6c7398043ef227
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8758965206d3c23c07ded0518d6c7398043ef227/tokio/src/task/join_set.rs
41
100
tokio-rs/tokio:tokio/src/task/join_set.rs:3
where F: Future<Output = T>, F: Send + 'static, T: Send, { self.insert(crate::spawn(task)); } /// Spawn the provided task on the provided runtime and store it in this `JoinSet`. pub fn spawn_on<F>(&mut self, task: F, handle: &Handle) where F: Future<Output = ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/join_set.rs
MIT
8758965206d3c23c07ded0518d6c7398043ef227
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8758965206d3c23c07ded0518d6c7398043ef227/tokio/src/task/join_set.rs
81
140
tokio-rs/tokio:tokio/src/task/join_set.rs:4
{ self.insert(local_set.spawn_local(task)); } fn insert(&mut self, jh: JoinHandle<T>) { let mut entry = self.inner.insert_idle(jh); // Set the waker that is notified when the task completes. entry.with_value_and_context(|jh, ctx| jh.set_join_waker(ctx.waker())); } /// ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/join_set.rs
MIT
8758965206d3c23c07ded0518d6c7398043ef227
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8758965206d3c23c07ded0518d6c7398043ef227/tokio/src/task/join_set.rs
121
180
tokio-rs/tokio:tokio/src/task/join_set.rs:5
/// /// This does not remove the tasks from the `JoinSet`. To wait for the tasks to complete /// cancellation, you should call `join_one` in a loop until the `JoinSet` is empty. pub fn abort_all(&mut self) { self.inner.for_each(|jh| jh.abort()); } /// Removes all tasks from this `JoinSet` w...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/join_set.rs
MIT
8758965206d3c23c07ded0518d6c7398043ef227
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8758965206d3c23c07ded0518d6c7398043ef227/tokio/src/task/join_set.rs
161
220
tokio-rs/tokio:tokio/src/task/join_set.rs:6
/// [coop budget]: crate::task#cooperative-scheduling fn poll_join_one(&mut self, cx: &mut Context<'_>) -> Poll<Result<Option<T>, JoinError>> { // The call to `pop_notified` moves the entry to the `idle` list. It is moved back to // the `notified` list if the waker is notified in the `poll` call bel...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/join_set.rs
MIT
8758965206d3c23c07ded0518d6c7398043ef227
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8758965206d3c23c07ded0518d6c7398043ef227/tokio/src/task/join_set.rs
201
248
tokio-rs/tokio:tokio/src/task/join_set.rs:1
use std::fmt; use std::future::Future; use std::pin::Pin; use std::task::{Context, Poll}; use crate::runtime::Handle; use crate::task::{JoinError, JoinHandle, LocalSet}; use crate::util::IdleNotifiedSet; /// A collection of tasks spawned on a Tokio runtime. /// /// A `JoinSet` can be used to await the completion of s...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/join_set.rs
MIT
1bb4d2316232a77d048e8797ba04d796911ffe30
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1bb4d2316232a77d048e8797ba04d796911ffe30/tokio/src/task/join_set.rs
1
60
tokio-rs/tokio:tokio/src/task/join_set.rs:2
/// assert!(seen[i]); /// } /// } /// ``` pub struct JoinSet<T> { inner: IdleNotifiedSet<JoinHandle<T>>, } impl<T> JoinSet<T> { /// Create a new `JoinSet`. pub fn new() -> Self { Self { inner: IdleNotifiedSet::new(), } } /// Returns the number of tasks curre...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/join_set.rs
MIT
1bb4d2316232a77d048e8797ba04d796911ffe30
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1bb4d2316232a77d048e8797ba04d796911ffe30/tokio/src/task/join_set.rs
41
100
tokio-rs/tokio:tokio/src/task/join_set.rs:3
} /// Spawn the provided task on the provided runtime and store it in this `JoinSet`. pub fn spawn_on<F>(&mut self, task: F, handle: &Handle) where F: Future<Output = T>, F: Send + 'static, T: Send, { self.insert(handle.spawn(task)); } /// Spawn the provided tas...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/join_set.rs
MIT
1bb4d2316232a77d048e8797ba04d796911ffe30
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1bb4d2316232a77d048e8797ba04d796911ffe30/tokio/src/task/join_set.rs
81
140
tokio-rs/tokio:tokio/src/task/join_set.rs:4
// Set the waker that is notified when the task completes. entry.with_value_and_context(|jh, ctx| jh.set_join_waker(ctx.waker())); } /// Waits until one of the tasks in the set completes and returns its output. /// /// Returns `None` if the set is empty. /// /// # Cancel Safety /// ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/join_set.rs
MIT
1bb4d2316232a77d048e8797ba04d796911ffe30
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1bb4d2316232a77d048e8797ba04d796911ffe30/tokio/src/task/join_set.rs
121
180
tokio-rs/tokio:tokio/src/task/join_set.rs:5
/// Removes all tasks from this `JoinSet` without aborting them. /// /// The tasks removed by this call will continue to run in the background even if the `JoinSet` /// is dropped. pub fn detach_all(&mut self) { self.inner.drain(drop); } /// Polls for one of the tasks in the set to comp...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/join_set.rs
MIT
1bb4d2316232a77d048e8797ba04d796911ffe30
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1bb4d2316232a77d048e8797ba04d796911ffe30/tokio/src/task/join_set.rs
161
220
tokio-rs/tokio:tokio/src/task/join_set.rs:6
None => { if self.is_empty() { return Poll::Ready(Ok(None)); } else { // The waker was set by `pop_notified`. return Poll::Pending; } } }; let res = entry.with_value_and_context(|jh, ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/join_set.rs
MIT
1bb4d2316232a77d048e8797ba04d796911ffe30
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1bb4d2316232a77d048e8797ba04d796911ffe30/tokio/src/task/join_set.rs
201
242
tokio-rs/tokio:tokio/src/task/local.rs:1
//! Runs `!Send` futures on the current thread. use crate::loom::cell::UnsafeCell; use crate::loom::sync::{Arc, Mutex}; use crate::runtime; use crate::runtime::task::{ self, JoinHandle, LocalOwnedTasks, SpawnLocation, Task, TaskHarnessScheduleHooks, }; use crate::runtime::{context, ThreadId, BOX_FUTURE_THRESHOLD}; ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/local.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/task/local.rs
1
60
tokio-rs/tokio:tokio/src/task/local.rs:6
/// // We ignore failures to send the response. /// let _ = response.send(n + 1); /// }, /// } /// } /// /// #[tokio::main] /// async fn main() { /// let spawner = LocalSpawner::new(); /// /// let (send, response) = oneshot::channel(); ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/local.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/task/local.rs
201
260
tokio-rs/tokio:tokio/src/task/local.rs:7
/// True if a task panicked without being handled and the local set is /// configured to shutdown on unhandled panic. unhandled_panic: Cell<bool>, } /// `LocalSet` state shared between threads. struct Shared { /// # Safety /// /// This field must *only* be accessed from the thread that owns the ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/local.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/task/local.rs
241
300
tokio-rs/tokio:tokio/src/task/local.rs:8
local_set: &'a LocalSet, #[pin] future: F, } } tokio_thread_local!(static CURRENT: LocalData = const { LocalData { ctx: RcCell::new(), wake_on_schedule: Cell::new(false), } }); struct LocalData { ctx: RcCell<Context>, wake_on_schedule: Cell<bool>, } impl LocalData { /// Should...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/local.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/task/local.rs
281
340
tokio-rs/tokio:tokio/src/task/local.rs:10
/// # async fn main() { /// let nonsend_data = Rc::new("my nonsend data..."); /// /// let local = task::LocalSet::new(); /// /// // Run the local task set. /// local.run_until(async move { /// let nonsend_data = nonsend_data.clone(); /// task::spawn_local(async move { /// ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/local.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/task/local.rs
361
420
tokio-rs/tokio:tokio/src/task/local.rs:11
if fut_size > BOX_FUTURE_THRESHOLD { spawn_local_inner(Box::pin(future), SpawnMeta::new_unnamed(fut_size)) } else { spawn_local_inner(future, SpawnMeta::new_unnamed(fut_size)) } } #[track_caller] pub(super) fn spawn_local_inner<F>(future: F, meta: SpawnMeta<'_>) -> ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/local.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/task/local.rs
401
460
tokio-rs/tokio:tokio/src/task/local.rs:12
// safety: we have verified that this is a `LocalRuntime` owned by the current thread unsafe { handle.spawn_local(task, id, meta.spawned_at) } } else { match CURRENT.with(|LocalData { ctx, .. }| ctx.get()) { None => panic!("`spawn_local` called from outsid...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/local.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/task/local.rs
441
500
tokio-rs/tokio:tokio/src/task/local.rs:13
impl Drop for LocalEnterGuard { fn drop(&mut self) { CURRENT.with( |LocalData { ctx, wake_on_schedule, }| { ctx.set(self.ctx.take()); wake_on_schedule.set(self.wake_on_schedule); }, ); } } imp...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/local.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/task/local.rs
481
540
tokio-rs/tokio:tokio/src/task/local.rs:14
}), _not_send: PhantomData, } } /// Enters the context of this `LocalSet`. /// /// The [`spawn_local`] method will spawn tasks on the `LocalSet` whose /// context you are inside. /// /// [`spawn_local`]: fn@crate::task::spawn_local pub fn enter(&self) -> LocalEnterGu...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/local.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/task/local.rs
521
580
tokio-rs/tokio:tokio/src/task/local.rs:18
/// This returns a future that runs the given future with a local set, /// allowing it to call [`spawn_local`] to spawn additional `!Send` futures. /// Any local futures spawned on the local set will be driven in the /// background until the future passed to `run_until` completes. When the future /// pa...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/local.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/task/local.rs
681
740
tokio-rs/tokio:tokio/src/task/local.rs:19
#[track_caller] pub(in crate::task) fn spawn_named<F>( &self, future: F, meta: SpawnMeta<'_>, ) -> JoinHandle<F::Output> where F: Future + 'static, F::Output: 'static, { self.spawn_named_inner(future, meta) } #[track_caller] fn spawn_named_inn...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/local.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/task/local.rs
721
780
tokio-rs/tokio:tokio/src/task/local.rs:20
// Run the task // // Safety: As spawned tasks are `!Send`, `run_unchecked` must be // used. We are responsible for maintaining the invariant that // `run_unchecked` is only called on threads that spawned the // task initially. Because `Loc...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/local.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/task/local.rs
761
820
tokio-rs/tokio:tokio/src/task/local.rs:21
}; task.map(|task| unsafe { // Safety: because the `LocalSet` itself is `!Send`, we know we are // on the same thread if we have access to the `LocalSet`, and can // therefore access the local run queue. self.context.shared.local_state.assert_owner(task) ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/local.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/task/local.rs
801
860
tokio-rs/tokio:tokio/src/task/local.rs:23
/// [`LocalSet::block_on`] and [`LocalSet::run_until`] will panic. /// /// # Panics /// /// This method panics if called after the `LocalSet` has started /// running. /// /// # Unstable /// /// This option is currently unstable and its implementa...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/local.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/task/local.rs
881
940
tokio-rs/tokio:tokio/src/task/local.rs:24
/// /// [`JoinHandle`]: struct@crate::task::JoinHandle pub fn unhandled_panic(&mut self, behavior: crate::runtime::UnhandledPanic) -> &mut Self { // TODO: This should be set as a builder Rc::get_mut(&mut self.context) .and_then(|ctx| Arc::get_mut(&mut ctx.shared))...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/local.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/task/local.rs
921
980
tokio-rs/tokio:tokio/src/task/local.rs:25
// There are still futures in the local set, but we've polled all the // futures in the run queue. Therefore, we can just return Pending // since the remaining futures will be woken from somewhere else. Poll::Pending } } } impl Default for LocalSet { fn default() -> ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/local.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/task/local.rs
961
1,020
tokio-rs/tokio:tokio/src/task/local.rs:26
// `Drop`ped from another thread. let local_queue = unsafe { // Safety: called from the thread that owns `LocalSet` self.context.shared.local_state.take_local_queue() }; for task in local_queue { drop(task); } /...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/local.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/task/local.rs
1,001
1,060
tokio-rs/tokio:tokio/src/task/local.rs:27
id, SpawnLocation::capture(), ) }; if let Some(notified) = notified { self.shared.schedule(notified); } handle } } // === impl LocalFuture === impl<T: Future> Future for RunUntil<'_, T> { type Output = T::Output; fn poll(self: Pin<...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/local.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/task/local.rs
1,041
1,100
tokio-rs/tokio:tokio/src/task/local.rs:28
Poll::Pending }) } } impl Shared { /// Schedule the provided task on the scheduler. fn schedule(&self, task: task::Notified<Arc<Self>>) { CURRENT.with(|localdata| { match localdata.ctx.get() { // If the current `LocalSet` is being polled, we don't need to wake it...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/local.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/task/local.rs
1,081
1,140
tokio-rs/tokio:tokio/src/task/local.rs:29
if let Some(queue) = lock.as_mut() { queue.push_back(task); drop(lock); self.waker.wake(); } } } }); } fn ptr_eq(&self, other: &Shared) -> bool { std::ptr::eq(self, other) ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/local.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/task/local.rs
1,121
1,180
tokio-rs/tokio:tokio/src/task/local.rs:30
match self.unhandled_panic { UnhandledPanic::Ignore => { // Do nothing } UnhandledPanic::ShutdownRuntime => { // This hook is only called from within the runtime, so // `CURRENT` should match with `&self`, i.e. t...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/local.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/task/local.rs
1,161
1,220
tokio-rs/tokio:tokio/src/task/local.rs:31
/// has the same [`ThreadId`] as [`Self::owner`]. unsafe fn task_push_back(&self, task: task::Notified<Arc<Shared>>) { // The caller ensures it is called from the same thread that owns // the LocalSet. self.assert_called_from_owner_thread(); self.local_queue .with_mut(|p...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/local.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/task/local.rs
1,201
1,260
tokio-rs/tokio:tokio/src/task/local.rs:32
unsafe fn assert_owner( &self, task: task::Notified<Arc<Shared>>, ) -> task::LocalNotified<Arc<Shared>> { // The caller ensures it is called from the same thread that owns // the LocalSet. self.assert_called_from_owner_thread(); self.owned.assert_owner(task) } ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/local.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/task/local.rs
1,241
1,300
tokio-rs/tokio:tokio/src/task/local.rs:33
#[cfg(all(test, not(loom)))] mod tests { use super::*; // Does a `LocalSet` running on a current-thread runtime...basically work? // // This duplicates a test in `tests/task_local_set.rs`, but because this is // a lib test, it will run under Miri, so this is necessary to catch stacked // borrow...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/local.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/task/local.rs
1,281
1,340
tokio-rs/tokio:tokio/src/task/local.rs:34
let notify = Arc::new(Notify::new()); let task = local.spawn_local({ let notify = notify.clone(); async move { notify.notified().await; } }); let mut run_until = Box::pin(local.run_until(async move { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/local.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/task/local.rs
1,321
1,349
tokio-rs/tokio:tokio/src/task/local.rs:8
local_set: &'a LocalSet, #[pin] future: F, } } tokio_thread_local!(static CURRENT: LocalData = const { LocalData { ctx: RcCell::new(), wake_on_schedule: Cell::new(false), } }); struct LocalData { ctx: RcCell<Context>, wake_on_schedule: Cell<bool>, } impl LocalData { /// Should...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/local.rs
MIT
231a3a69f9a191c88b94a9ff141865f9a8d0bf84
github
async-runtime
https://github.com/tokio-rs/tokio/blob/231a3a69f9a191c88b94a9ff141865f9a8d0bf84/tokio/src/task/local.rs
281
340
tokio-rs/tokio:tokio/src/task/local.rs:10
/// # #[tokio::main(flavor = "current_thread")] /// # async fn main() { /// let nonsend_data = Rc::new("my nonsend data..."); /// /// let local = task::LocalSet::new(); /// /// // Run the local task set. /// local.run_until(async move { /// let nonsend_data = nonsend_data.clone(); ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/task/local.rs
MIT
231a3a69f9a191c88b94a9ff141865f9a8d0bf84
github
async-runtime
https://github.com/tokio-rs/tokio/blob/231a3a69f9a191c88b94a9ff141865f9a8d0bf84/tokio/src/task/local.rs
361
420