/rust/registry/src/index.crates.io-1949cf8c6b5b557f/futures-util-0.3.21/src/future/mod.rs
Line | Count | Source |
1 | | //! Asynchronous values. |
2 | | //! |
3 | | //! This module contains: |
4 | | //! |
5 | | //! - The [`Future`] trait. |
6 | | //! - The [`FutureExt`] and [`TryFutureExt`] trait, which provides adapters for |
7 | | //! chaining and composing futures. |
8 | | //! - Top-level future combinators like [`lazy`](lazy()) which creates a future |
9 | | //! from a closure that defines its return value, and [`ready`](ready()), |
10 | | //! which constructs a future with an immediate defined value. |
11 | | |
12 | | #[doc(no_inline)] |
13 | | pub use core::future::Future; |
14 | | |
15 | | #[cfg(feature = "alloc")] |
16 | | pub use futures_core::future::{BoxFuture, LocalBoxFuture}; |
17 | | pub use futures_core::future::{FusedFuture, TryFuture}; |
18 | | pub use futures_task::{FutureObj, LocalFutureObj, UnsafeFutureObj}; |
19 | | |
20 | | // Extension traits and combinators |
21 | | #[allow(clippy::module_inception)] |
22 | | mod future; |
23 | | pub use self::future::{ |
24 | | Flatten, Fuse, FutureExt, Inspect, IntoStream, Map, MapInto, NeverError, Then, UnitError, |
25 | | }; |
26 | | |
27 | | #[deprecated(note = "This is now an alias for [Flatten](Flatten)")] |
28 | | pub use self::future::FlattenStream; |
29 | | |
30 | | #[cfg(feature = "std")] |
31 | | pub use self::future::CatchUnwind; |
32 | | |
33 | | #[cfg(feature = "channel")] |
34 | | #[cfg_attr(docsrs, doc(cfg(feature = "channel")))] |
35 | | #[cfg(feature = "std")] |
36 | | pub use self::future::{Remote, RemoteHandle}; |
37 | | |
38 | | #[cfg(feature = "std")] |
39 | | pub use self::future::{Shared, WeakShared}; |
40 | | |
41 | | mod try_future; |
42 | | pub use self::try_future::{ |
43 | | AndThen, ErrInto, InspectErr, InspectOk, IntoFuture, MapErr, MapOk, MapOkOrElse, OkInto, |
44 | | OrElse, TryFlatten, TryFlattenStream, TryFutureExt, UnwrapOrElse, |
45 | | }; |
46 | | |
47 | | #[cfg(feature = "sink")] |
48 | | #[cfg_attr(docsrs, doc(cfg(feature = "sink")))] |
49 | | pub use self::try_future::FlattenSink; |
50 | | |
51 | | // Primitive futures |
52 | | |
53 | | mod lazy; |
54 | | pub use self::lazy::{lazy, Lazy}; |
55 | | |
56 | | mod pending; |
57 | | pub use self::pending::{pending, Pending}; |
58 | | |
59 | | mod maybe_done; |
60 | | pub use self::maybe_done::{maybe_done, MaybeDone}; |
61 | | |
62 | | mod try_maybe_done; |
63 | | pub use self::try_maybe_done::{try_maybe_done, TryMaybeDone}; |
64 | | |
65 | | mod option; |
66 | | pub use self::option::OptionFuture; |
67 | | |
68 | | mod poll_fn; |
69 | | pub use self::poll_fn::{poll_fn, PollFn}; |
70 | | |
71 | | mod poll_immediate; |
72 | | pub use self::poll_immediate::{poll_immediate, PollImmediate}; |
73 | | |
74 | | mod ready; |
75 | | pub use self::ready::{err, ok, ready, Ready}; |
76 | | |
77 | | mod join; |
78 | | pub use self::join::{join, join3, join4, join5, Join, Join3, Join4, Join5}; |
79 | | |
80 | | #[cfg(feature = "alloc")] |
81 | | mod join_all; |
82 | | #[cfg(feature = "alloc")] |
83 | | pub use self::join_all::{join_all, JoinAll}; |
84 | | |
85 | | mod select; |
86 | | pub use self::select::{select, Select}; |
87 | | |
88 | | #[cfg(feature = "alloc")] |
89 | | mod select_all; |
90 | | #[cfg(feature = "alloc")] |
91 | | pub use self::select_all::{select_all, SelectAll}; |
92 | | |
93 | | mod try_join; |
94 | | pub use self::try_join::{ |
95 | | try_join, try_join3, try_join4, try_join5, TryJoin, TryJoin3, TryJoin4, TryJoin5, |
96 | | }; |
97 | | |
98 | | #[cfg(feature = "alloc")] |
99 | | mod try_join_all; |
100 | | #[cfg(feature = "alloc")] |
101 | | pub use self::try_join_all::{try_join_all, TryJoinAll}; |
102 | | |
103 | | mod try_select; |
104 | | pub use self::try_select::{try_select, TrySelect}; |
105 | | |
106 | | #[cfg(feature = "alloc")] |
107 | | mod select_ok; |
108 | | #[cfg(feature = "alloc")] |
109 | | pub use self::select_ok::{select_ok, SelectOk}; |
110 | | |
111 | | mod either; |
112 | | pub use self::either::Either; |
113 | | |
114 | | #[cfg(not(futures_no_atomic_cas))] |
115 | | #[cfg(feature = "alloc")] |
116 | | mod abortable; |
117 | | #[cfg(not(futures_no_atomic_cas))] |
118 | | #[cfg(feature = "alloc")] |
119 | | pub use crate::abortable::{AbortHandle, AbortRegistration, Abortable, Aborted}; |
120 | | #[cfg(not(futures_no_atomic_cas))] |
121 | | #[cfg(feature = "alloc")] |
122 | | pub use abortable::abortable; |
123 | | |
124 | | // Just a helper function to ensure the futures we're returning all have the |
125 | | // right implementations. |
126 | 722k | pub(crate) fn assert_future<T, F>(future: F) -> F |
127 | 722k | where |
128 | 722k | F: Future<Output = T>, |
129 | | { |
130 | 722k | future |
131 | 722k | } Unexecuted instantiation: futures_util::future::assert_future::<devices::virtio::iommu::run::{closure#2}::__PrivResult<core::result::Result<(), devices::virtio::iommu::IommuError>, core::result::Result<(), anyhow::Error>, core::result::Result<(), devices::virtio::iommu::IommuError>, core::result::Result<(), devices::virtio::iommu::IommuError>>, futures_util::future::poll_fn::PollFn<devices::virtio::iommu::run::{closure#2}::{closure#0}>>Unexecuted instantiation: futures_util::future::assert_future::<devices::virtio::scsi::device::run_worker::{closure#0}::__PrivResult<(), core::result::Result<(), anyhow::Error>>, futures_util::future::poll_fn::PollFn<devices::virtio::scsi::device::run_worker::{closure#0}::{closure#0}>>Unexecuted instantiation: futures_util::future::assert_future::<devices::virtio::scsi::device::handle_queue::{closure#0}::__PrivResult<core::option::Option<()>, core::result::Result<u64, cros_async::io_ext::AsyncError>>, futures_util::future::poll_fn::PollFn<devices::virtio::scsi::device::handle_queue::{closure#0}::{closure#0}>>futures_util::future::assert_future::<devices::virtio::block::asynchronous::run_worker::{closure#0}::__PrivResult<core::option::Option<()>, core::result::Result<(), devices::virtio::block::asynchronous::ControlError>, core::result::Result<(), devices::virtio::block::asynchronous::ExecuteError>, core::result::Result<(), anyhow::Error>, core::option::Option<devices::virtio::block::asynchronous::WorkerCmd>>, futures_util::future::poll_fn::PollFn<devices::virtio::block::asynchronous::run_worker::{closure#0}::{closure#0}>>Line | Count | Source | 126 | 1.84k | pub(crate) fn assert_future<T, F>(future: F) -> F | 127 | 1.84k | where | 128 | 1.84k | F: Future<Output = T>, | 129 | | { | 130 | 1.84k | future | 131 | 1.84k | } |
Unexecuted instantiation: futures_util::future::assert_future::<devices::virtio::block::asynchronous::run_worker::{closure#0}::__PrivResult<core::option::Option<()>, devices::virtio::queue::Queue>, futures_util::future::poll_fn::PollFn<devices::virtio::block::asynchronous::run_worker::{closure#0}::{closure#3}>>Unexecuted instantiation: futures_util::future::assert_future::<devices::virtio::block::asynchronous::run_worker::{closure#0}::__PrivResult<core::option::Option<()>, devices::virtio::queue::Queue>, futures_util::future::poll_fn::PollFn<devices::virtio::block::asynchronous::run_worker::{closure#0}::{closure#2}>>futures_util::future::assert_future::<devices::virtio::block::asynchronous::handle_queue::{closure#0}::__PrivResult<core::option::Option<()>, core::result::Result<u64, cros_async::io_ext::AsyncError>, core::result::Result<(), futures_channel::oneshot::Canceled>>, futures_util::future::poll_fn::PollFn<devices::virtio::block::asynchronous::handle_queue::{closure#0}::{closure#0}>>Line | Count | Source | 126 | 355k | pub(crate) fn assert_future<T, F>(future: F) -> F | 127 | 355k | where | 128 | 355k | F: Future<Output = T>, | 129 | | { | 130 | 355k | future | 131 | 355k | } |
futures_util::future::assert_future::<core::option::Option<devices::virtio::block::asynchronous::WorkerCmd>, futures_util::stream::stream::next::Next<futures_channel::mpsc::UnboundedReceiver<devices::virtio::block::asynchronous::WorkerCmd>>> Line | Count | Source | 126 | 1.84k | pub(crate) fn assert_future<T, F>(future: F) -> F | 127 | 1.84k | where | 128 | 1.84k | F: Future<Output = T>, | 129 | | { | 130 | 1.84k | future | 131 | 1.84k | } |
futures_util::future::assert_future::<core::option::Option<()>, futures_util::stream::stream::next::Next<futures_util::stream::futures_unordered::FuturesUnordered<futures_util::future::future::remote_handle::Remote<devices::virtio::block::asynchronous::handle_queue::{closure#0}>>>>Line | Count | Source | 126 | 1.84k | pub(crate) fn assert_future<T, F>(future: F) -> F | 127 | 1.84k | where | 128 | 1.84k | F: Future<Output = T>, | 129 | | { | 130 | 1.84k | future | 131 | 1.84k | } |
Unexecuted instantiation: futures_util::future::assert_future::<core::option::Option<()>, futures_util::stream::stream::next::Next<futures_util::stream::futures_unordered::FuturesUnordered<devices::virtio::scsi::device::process_one_chain::{closure#0}>>>futures_util::future::assert_future::<core::option::Option<()>, futures_util::stream::stream::next::Next<futures_util::stream::futures_unordered::FuturesUnordered<devices::virtio::block::asynchronous::process_one_chain::{closure#0}>>>Line | Count | Source | 126 | 355k | pub(crate) fn assert_future<T, F>(future: F) -> F | 127 | 355k | where | 128 | 355k | F: Future<Output = T>, | 129 | | { | 130 | 355k | future | 131 | 355k | } |
futures_util::future::assert_future::<core::result::Result<devices::virtio::queue::Queue, alloc::boxed::Box<dyn core::any::Any + core::marker::Send>>, futures_util::future::future::catch_unwind::CatchUnwind<core::panic::unwind_safe::AssertUnwindSafe<devices::virtio::block::asynchronous::handle_queue::{closure#0}>>>Line | Count | Source | 126 | 495 | pub(crate) fn assert_future<T, F>(future: F) -> F | 127 | 495 | where | 128 | 495 | F: Future<Output = T>, | 129 | | { | 130 | 495 | future | 131 | 495 | } |
Unexecuted instantiation: futures_util::future::assert_future::<core::result::Result<(), anyhow::Error>, core::pin::Pin<alloc::boxed::Box<dyn core::future::future::Future<Output = core::result::Result<(), anyhow::Error>>>>> futures_util::future::assert_future::<core::result::Result<(), anyhow::Error>, futures_util::future::future::fuse::Fuse<devices::virtio::async_utils::await_and_exit::{closure#0}>>Line | Count | Source | 126 | 1.01k | pub(crate) fn assert_future<T, F>(future: F) -> F | 127 | 1.01k | where | 128 | 1.01k | F: Future<Output = T>, | 129 | | { | 130 | 1.01k | future | 131 | 1.01k | } |
Unexecuted instantiation: futures_util::future::assert_future::<core::result::Result<(), devices::virtio::iommu::IommuError>, futures_util::future::future::fuse::Fuse<devices::virtio::iommu::request_queue::{closure#0}>>Unexecuted instantiation: futures_util::future::assert_future::<core::result::Result<(), devices::virtio::iommu::IommuError>, futures_util::future::future::fuse::Fuse<devices::virtio::iommu::sys::linux::handle_command_tube::{closure#0}>>Unexecuted instantiation: futures_util::future::assert_future::<core::result::Result<(), devices::virtio::iommu::IommuError>, futures_util::future::future::fuse::Fuse<devices::virtio::iommu::sys::linux::handle_translate_request::{closure#0}>>futures_util::future::assert_future::<core::result::Result<(), devices::virtio::block::asynchronous::ControlError>, futures_util::future::future::fuse::Fuse<devices::virtio::block::asynchronous::flush_disk::{closure#0}>>Line | Count | Source | 126 | 1.01k | pub(crate) fn assert_future<T, F>(future: F) -> F | 127 | 1.01k | where | 128 | 1.01k | F: Future<Output = T>, | 129 | | { | 130 | 1.01k | future | 131 | 1.01k | } |
futures_util::future::assert_future::<core::result::Result<(), devices::virtio::block::asynchronous::ExecuteError>, futures_util::future::future::fuse::Fuse<devices::virtio::block::asynchronous::handle_command_tube::{closure#0}>>Line | Count | Source | 126 | 1.01k | pub(crate) fn assert_future<T, F>(future: F) -> F | 127 | 1.01k | where | 128 | 1.01k | F: Future<Output = T>, | 129 | | { | 130 | 1.01k | future | 131 | 1.01k | } |
futures_util::future::assert_future::<core::result::Result<u64, cros_async::io_ext::AsyncError>, futures_util::future::future::fuse::Fuse<<cros_async::event::EventAsync>::next_val::{closure#0}>>Line | Count | Source | 126 | 494 | pub(crate) fn assert_future<T, F>(future: F) -> F | 127 | 494 | where | 128 | 494 | F: Future<Output = T>, | 129 | | { | 130 | 494 | future | 131 | 494 | } |
Unexecuted instantiation: futures_util::future::assert_future::<devices::virtio::queue::Queue, futures_util::future::future::fuse::Fuse<futures_util::future::future::remote_handle::RemoteHandle<devices::virtio::queue::Queue>>> Unexecuted instantiation: futures_util::future::assert_future::<(), futures_util::future::maybe_done::MaybeDone<core::pin::Pin<&mut devices::virtio::async_utils::await_and_exit::{closure#0}>>>Unexecuted instantiation: futures_util::future::assert_future::<(), futures_util::future::maybe_done::MaybeDone<core::pin::Pin<&mut devices::virtio::pmem::handle_queue::{closure#0}>>>Unexecuted instantiation: futures_util::future::assert_future::<(), futures_util::future::maybe_done::MaybeDone<core::pin::Pin<&mut devices::virtio::pmem::pageout::{closure#0}>>>futures_util::future::assert_future::<(), futures_util::future::pending::Pending<()>> Line | Count | Source | 126 | 500 | pub(crate) fn assert_future<T, F>(future: F) -> F | 127 | 500 | where | 128 | 500 | F: Future<Output = T>, | 129 | | { | 130 | 500 | future | 131 | 500 | } |
futures_util::future::assert_future::<(), futures_util::future::future::remote_handle::Remote<devices::virtio::block::asynchronous::handle_queue::{closure#0}>>Line | Count | Source | 126 | 495 | pub(crate) fn assert_future<T, F>(future: F) -> F | 127 | 495 | where | 128 | 495 | F: Future<Output = T>, | 129 | | { | 130 | 495 | future | 131 | 495 | } |
Unexecuted instantiation: futures_util::future::assert_future::<(), futures_util::future::future::fuse::Fuse<devices::virtio::scsi::device::handle_queue::{closure#0}>>Unexecuted instantiation: futures_util::future::assert_future::<(), futures_util::stream::stream::collect::Collect<futures_util::stream::futures_unordered::FuturesUnordered<devices::virtio::block::asynchronous::process_one_chain::{closure#0}>, ()>>Unexecuted instantiation: futures_util::future::assert_future::<(), futures_util::future::poll_fn::PollFn<<cros_async::sys::linux::uring_executor::UringReactor as cros_async::common_executor::Reactor>::on_executor_drop::{closure#1}>>Unexecuted instantiation: futures_util::future::assert_future::<_, _> |