1
#![cfg_attr(docsrs, feature(doc_cfg))]
2
#![doc = include_str!("../README.md")]
3
// @@ begin lint list maintained by maint/add_warning @@
4
#![allow(renamed_and_removed_lints)] // @@REMOVE_WHEN(ci_arti_stable)
5
#![allow(unknown_lints)] // @@REMOVE_WHEN(ci_arti_nightly)
6
#![warn(missing_docs)]
7
#![warn(noop_method_call)]
8
#![warn(unreachable_pub)]
9
#![warn(clippy::all)]
10
#![deny(clippy::await_holding_lock)]
11
#![deny(clippy::cargo_common_metadata)]
12
#![deny(clippy::cast_lossless)]
13
#![deny(clippy::checked_conversions)]
14
#![allow(clippy::cognitive_complexity)] // See arti#2556
15
#![deny(clippy::debug_assert_with_mut_call)]
16
#![deny(clippy::exhaustive_enums)]
17
#![deny(clippy::exhaustive_structs)]
18
#![deny(clippy::expl_impl_clone_on_copy)]
19
#![deny(clippy::fallible_impl_from)]
20
#![deny(clippy::implicit_clone)]
21
#![deny(clippy::large_stack_arrays)]
22
#![warn(clippy::manual_ok_or)]
23
#![deny(clippy::missing_docs_in_private_items)]
24
#![warn(clippy::needless_borrow)]
25
#![warn(clippy::needless_pass_by_value)]
26
#![warn(clippy::option_option)]
27
#![warn(clippy::or_fun_call)]
28
#![deny(clippy::print_stderr)]
29
#![deny(clippy::print_stdout)]
30
#![warn(clippy::rc_buffer)]
31
#![deny(clippy::ref_option_ref)]
32
#![warn(clippy::semicolon_if_nothing_returned)]
33
#![warn(clippy::trait_duplication_in_bounds)]
34
#![deny(clippy::unchecked_time_subtraction)]
35
#![deny(clippy::unnecessary_wraps)]
36
#![warn(clippy::unseparated_literal_suffix)]
37
#![deny(clippy::unwrap_used)]
38
#![deny(clippy::mod_module_files)]
39
#![allow(clippy::let_unit_value)] // This can reasonably be done for explicitness
40
#![allow(clippy::uninlined_format_args)]
41
#![allow(clippy::significant_drop_in_scrutinee)] // arti/-/merge_requests/588/#note_2812945
42
#![allow(clippy::result_large_err)] // temporary workaround for arti#587
43
#![allow(clippy::needless_raw_string_hashes)] // complained-about code is fine, often best
44
#![allow(clippy::needless_lifetimes)] // See arti#1765
45
#![allow(mismatched_lifetime_syntaxes)] // temporary workaround for arti#2060
46
#![allow(clippy::collapsible_if)] // See arti#2342
47
#![deny(clippy::unused_async)]
48
#![deny(clippy::string_slice)] // See arti#2571
49
#![allow(recursion_depth_exceeding_limit)] // arti#2715, rust/issues/159228
50
//! <!-- @@ end lint list maintained by maint/add_warning @@ -->
51

            
52
mod join_read_write;
53
mod prepare_send;
54
mod sink_close_channel;
55
mod sink_try_send;
56
mod sinkext;
57
mod watch;
58

            
59
pub mod bw_pool;
60
pub mod counting_streams;
61
pub mod global_rate_limit;
62
pub mod oneshot_broadcast;
63
pub mod peekable_stream;
64
pub mod rate_limited_writer;
65
pub mod stream_peek;
66

            
67
pub use join_read_write::*;
68

            
69
pub use prepare_send::{SinkPrepareExt, SinkPrepareSendFuture, SinkSendable};
70

            
71
pub use sinkext::SinkExt;
72

            
73
pub use sink_close_channel::SinkCloseChannel;
74

            
75
pub use sink_try_send::{ErasedSinkTrySendError, MpscOtherSinkTrySendError};
76
pub use sink_try_send::{SinkTrySend, SinkTrySendError};
77

            
78
pub use watch::{DropNotifyEofSignallable, DropNotifyWatchSender, PostageWatchSenderExt};
79

            
80
pub use oneshot_fused_workaround as oneshot;
81

            
82
use futures::channel::mpsc;
83

            
84
/// Precisely [`futures::channel::mpsc::channel`]
85
///
86
/// In `arti.git` we disallow this method, because we want to ensure
87
/// that all our queues participate in our memory quota system
88
/// (see `tor-memquota` and `tor_proto::memquota`).y
89
///
90
/// Use this method to make an `mpsc::channel` when you know that's not appropriate.
91
///
92
/// (`#[allow]` on an expression is unstable Rust, so this is needed to avoid
93
/// decorating whole functions with the allow.)
94
#[allow(clippy::disallowed_methods)] // We don't care about mq tracking in this test code
95
2673
pub fn mpsc_channel_no_memquota<T>(buffer: usize) -> (mpsc::Sender<T>, mpsc::Receiver<T>) {
96
2673
    mpsc::channel(buffer)
97
2673
}