oneshot_fused_workaround/
lib.rs1#![cfg_attr(docsrs, feature(doc_cfg))]
20#![doc = include_str!("../README.md")]
21#![allow(renamed_and_removed_lints)] #![allow(unknown_lints)] #![warn(missing_docs)]
25#![warn(noop_method_call)]
26#![warn(unreachable_pub)]
27#![warn(clippy::all)]
28#![deny(clippy::await_holding_lock)]
29#![deny(clippy::cargo_common_metadata)]
30#![deny(clippy::cast_lossless)]
31#![deny(clippy::checked_conversions)]
32#![allow(clippy::cognitive_complexity)] #![deny(clippy::debug_assert_with_mut_call)]
34#![deny(clippy::exhaustive_enums)]
35#![deny(clippy::exhaustive_structs)]
36#![deny(clippy::expl_impl_clone_on_copy)]
37#![deny(clippy::fallible_impl_from)]
38#![deny(clippy::implicit_clone)]
39#![deny(clippy::large_stack_arrays)]
40#![warn(clippy::manual_ok_or)]
41#![deny(clippy::missing_docs_in_private_items)]
42#![warn(clippy::needless_borrow)]
43#![warn(clippy::needless_pass_by_value)]
44#![warn(clippy::option_option)]
45#![warn(clippy::or_fun_call)]
46#![deny(clippy::print_stderr)]
47#![deny(clippy::print_stdout)]
48#![warn(clippy::rc_buffer)]
49#![deny(clippy::ref_option_ref)]
50#![warn(clippy::semicolon_if_nothing_returned)]
51#![warn(clippy::trait_duplication_in_bounds)]
52#![deny(clippy::unchecked_time_subtraction)]
53#![deny(clippy::unnecessary_wraps)]
54#![warn(clippy::unseparated_literal_suffix)]
55#![deny(clippy::unwrap_used)]
56#![deny(clippy::mod_module_files)]
57#![allow(clippy::let_unit_value)] #![allow(clippy::uninlined_format_args)]
59#![allow(clippy::significant_drop_in_scrutinee)] #![allow(clippy::result_large_err)] #![allow(clippy::needless_raw_string_hashes)] #![allow(clippy::needless_lifetimes)] #![allow(mismatched_lifetime_syntaxes)] #![allow(clippy::collapsible_if)] #![deny(clippy::unused_async)]
66#![deny(clippy::string_slice)] #![allow(recursion_depth_exceeding_limit)] #![warn(unnameable_types)]
72
73use futures::FutureExt as _;
74use futures::channel::oneshot as fut_oneshot;
75
76pub use fut_oneshot::Canceled;
77
78#[allow(clippy::disallowed_types)]
84pub type Sender<T> = fut_oneshot::Sender<T>;
85
86#[allow(clippy::disallowed_types)]
88pub type Receiver<T> = futures::future::Fuse<fut_oneshot::Receiver<T>>;
89
90pub fn channel<T>() -> (Sender<T>, Receiver<T>) {
92 #[allow(clippy::disallowed_methods)]
93 let (tx, rx) = fut_oneshot::channel();
94 (tx, rx.fuse())
95}