tor_memquota/
internal_prelude.rs

1//! Internal prelude
2//!
3//! This file contains most of the imports we wish to use, throughout this crate.
4//!
5//! Every module does `use crate::internal_prelude::*;`
6//!
7//! Exceptions:
8//!
9//!  * Names that are private to a module and its submodules
10//!    are imported to the sub-modules via `use super::*`.
11//!    (Thus, the sub-module inherits the prelude from its parent.)
12//!
13//!  * Broad names from specific contexts, that are unsuitable for wide imports.
14//!    For example, individual cell and message names from `tor-cell`,
15//!    and the types from `tor_proto::stream` other than the high-level `DataStream`.
16
17#![allow(unused_imports)]
18
19pub(crate) use std::{
20    cmp::{Ordering, Reverse},
21    collections::{BinaryHeap, HashSet},
22    fmt::{self, Debug},
23    future::Future,
24    marker::PhantomData,
25    mem::{self, size_of},
26    panic::{AssertUnwindSafe, catch_unwind},
27    pin::Pin,
28    sync::{Arc, Mutex, MutexGuard, PoisonError, Weak},
29};
30
31pub(crate) use futures::{
32    FutureExt as _, Sink, SinkExt as _, Stream, StreamExt as _,
33    channel::mpsc,
34    stream::FusedStream,
35    task::{Spawn, SpawnError, SpawnExt as _},
36};
37
38pub(crate) use std::task::Waker;
39
40pub(crate) use {
41    derive_deftly::{Deftly, define_derive_deftly, derive_deftly_adhoc},
42    derive_more::{Constructor, Deref, DerefMut},
43    dyn_clone::DynClone,
44    educe::Educe,
45    itertools::chain,
46    paste::paste,
47    pin_project::pin_project,
48    serde::{Deserialize, Serialize},
49    slotmap_careful::SlotMap,
50    static_assertions::assert_not_impl_any,
51    thiserror::Error,
52    tracing::{debug, error, info},
53    void::{ResultVoidExt as _, Void},
54};
55
56pub(crate) use {
57    tor_async_utils::mpsc_channel_no_memquota,
58    tor_async_utils::stream_peek::StreamUnobtrusivePeeker,
59    tor_basic_utils::ByteQty as Qty,
60    tor_config::{ConfigBuildError, ExplicitOrAuto, ReconfigureError},
61    tor_error::{Bug, ErrorKind, HasKind, error_report, internal, into_internal, trace_report},
62    tor_log_ratelim::log_ratelim,
63    tor_rtcompat::{CoarseInstant, CoarseTimeProvider, DynTimeProvider},
64};
65
66pub(crate) use crate::{
67    config::{Config, ConfigInner},
68    drop_bomb::{DropBomb, DropBombCondition},
69    drop_reentrancy,
70    error::{Error, ReclaimCrashed, StartupError, TrackerCorrupted},
71    if_enabled::{EnabledToken, IfEnabled},
72    memory_cost::{HasMemoryCost, HasTypedMemoryCost, TypedParticipation},
73    mtracker::{self, Account, IsParticipant, MemoryQuotaTracker, Participation},
74    private::Sealed,
75    refcount,
76    utils::DefaultExtTake,
77};