pub struct HandleRcVec<T: Unpin>(Arc<UnsafeCell<Vec<JoinHandle<T>>>>);
Expand description
A container for managing a collection of asynchronous task join handles.
This structure encapsulates a reference-counted, mutable vector of asynchronous task handles, enabling concurrent polling of multiple tasks. Its design allows shared ownership and in-place mutation of the task collection without requiring external synchronization, supporting operations that extend or poll the set of join handles as part of asynchronous execution workflows.
Tuple Fields§
§0: Arc<UnsafeCell<Vec<JoinHandle<T>>>>
Implementations§
Source§impl<T: Unpin> HandleRcVec<T>
impl<T: Unpin> HandleRcVec<T>
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates and returns a new instance of the container for asynchronous task handles.
Constructs an empty container by encapsulating an empty vector within an Arc and UnsafeCell, thereby enabling shared mutable access suitable for concurrent asynchronous operations.
Sourcepub fn extend_iter(&self, v: impl Iterator<Item = JoinHandle<T>>)
pub fn extend_iter(&self, v: impl Iterator<Item = JoinHandle<T>>)
Extends the internal collection with join handles obtained from the provided iterator. This method iterates over each join handle from the iterator and appends it into the underlying storage, making the join handles available for future asynchronous polling.
Trait Implementations§
Source§impl<T: Unpin> Clone for HandleRcVec<T>
impl<T: Unpin> Clone for HandleRcVec<T>
Source§fn clone(&self) -> Self
fn clone(&self) -> Self
Clones the join handle collection by duplicating its internal shared pointer.
This method produces a new instance that shares the same underlying join handle storage, enabling multiple owners of the asynchronous task collection without copying the actual handles.
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl<T: Unpin> Default for HandleRcVec<T>
impl<T: Unpin> Default for HandleRcVec<T>
Source§fn default() -> Self
fn default() -> Self
Returns a new default instance by invoking the primary constructor.
This method serves as a convenience alias for creating a default instance, allowing integration with traits or patterns that rely on default initialization. It encapsulates the functionality of the constructor without exposing implementation details.
Source§impl<T: Unpin> Future for HandleRcVec<T>
impl<T: Unpin> Future for HandleRcVec<T>
Source§fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output>
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output>
Polls a collection of asynchronous tasks and returns the output of the first task that is complete.
This method iterates over the stored join handles and evaluates each one to determine if its associated task has finished, returning the completed result if available. If none of the tasks are ready, it returns a pending status.
Auto Trait Implementations§
impl<T> Freeze for HandleRcVec<T>
impl<T> !RefUnwindSafe for HandleRcVec<T>
impl<T> !Send for HandleRcVec<T>
impl<T> !Sync for HandleRcVec<T>
impl<T> Unpin for HandleRcVec<T>
impl<T> !UnwindSafe for HandleRcVec<T>
Blanket Implementations§
Source§impl<T> AllocForAny<T> for T
impl<T> AllocForAny<T> for T
Source§fn galloc(self) -> &'static T
fn galloc(self) -> &'static T
Provides a method to allocate an instance of T
on the heap with a static lifetime.
This implementation of galloc
takes ownership of the T
instance and uses the alloc
function to place it in a location with a static lifetime, presumably managing it in a way that ensures its persistence for the duration of the program.
This can be particularly useful for scenarios where a static lifetime is required, such as when interfacing with systems or patterns that necessitate global state or long-lived data.
Source§fn galloc_mut(self) -> &'static T
fn galloc_mut(self) -> &'static T
Provides a method that moves the instance and returns a reference to it allocated with a static lifetime.
This method utilizes alloc_mut
to perform the allocation, likely involving allocating the resource in a manner that ensures it lives for the entire duration of the application.
These semantics allow the user to safely assume that the reference will not expire during the program’s execution, making it suitable for long-lived data structures or operations that require such guarantees.
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn map<U, F>(self, f: F) -> Map<Self, F>
fn map<U, F>(self, f: F) -> Map<Self, F>
Source§fn map_into<U>(self) -> MapInto<Self, U>
fn map_into<U>(self) -> MapInto<Self, U>
Source§fn then<Fut, F>(self, f: F) -> Then<Self, Fut, F>
fn then<Fut, F>(self, f: F) -> Then<Self, Fut, F>
f
. Read moreSource§fn left_future<B>(self) -> Either<Self, B>
fn left_future<B>(self) -> Either<Self, B>
Source§fn right_future<A>(self) -> Either<A, Self>
fn right_future<A>(self) -> Either<A, Self>
Source§fn into_stream(self) -> IntoStream<Self>where
Self: Sized,
fn into_stream(self) -> IntoStream<Self>where
Self: Sized,
Source§fn flatten(self) -> Flatten<Self>
fn flatten(self) -> Flatten<Self>
Source§fn flatten_stream(self) -> FlattenStream<Self>
fn flatten_stream(self) -> FlattenStream<Self>
Source§fn fuse(self) -> Fuse<Self>where
Self: Sized,
fn fuse(self) -> Fuse<Self>where
Self: Sized,
poll
will never again be called once it has
completed. This method can be used to turn any Future
into a
FusedFuture
. Read moreSource§fn inspect<F>(self, f: F) -> Inspect<Self, F>
fn inspect<F>(self, f: F) -> Inspect<Self, F>
Source§fn catch_unwind(self) -> CatchUnwind<Self>where
Self: Sized + UnwindSafe,
fn catch_unwind(self) -> CatchUnwind<Self>where
Self: Sized + UnwindSafe,
Source§fn remote_handle(self) -> (Remote<Self>, RemoteHandle<Self::Output>)where
Self: Sized,
fn remote_handle(self) -> (Remote<Self>, RemoteHandle<Self::Output>)where
Self: Sized,
()
on completion and sends
its output to another future on a separate task. Read moreSource§fn boxed<'a>(self) -> Pin<Box<dyn Future<Output = Self::Output> + Send + 'a>>
fn boxed<'a>(self) -> Pin<Box<dyn Future<Output = Self::Output> + Send + 'a>>
Source§fn boxed_local<'a>(self) -> Pin<Box<dyn Future<Output = Self::Output> + 'a>>where
Self: Sized + 'a,
fn boxed_local<'a>(self) -> Pin<Box<dyn Future<Output = Self::Output> + 'a>>where
Self: Sized + 'a,
Source§fn unit_error(self) -> UnitError<Self>where
Self: Sized,
fn unit_error(self) -> UnitError<Self>where
Self: Sized,
Future<Output = T>
into a
TryFuture<Ok = T, Error = ()
>.Source§fn never_error(self) -> NeverError<Self>where
Self: Sized,
fn never_error(self) -> NeverError<Self>where
Self: Sized,
Future<Output = T>
into a
TryFuture<Ok = T, Error = Never
>.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more