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::{catch_unwind, AssertUnwindSafe},
27    pin::Pin,
28    sync::{Arc, Mutex, MutexGuard, PoisonError, Weak},
29};
30
31pub(crate) use futures::{
32    channel::mpsc,
33    stream::FusedStream,
34    task::{noop_waker_ref, Spawn, SpawnError, SpawnExt as _},
35    FutureExt as _, Sink, SinkExt as _, Stream, StreamExt as _,
36};
37
38pub(crate) use {
39    derive_deftly::{define_derive_deftly, derive_deftly_adhoc, Deftly},
40    derive_more::{Constructor, Deref, DerefMut},
41    dyn_clone::DynClone,
42    educe::Educe,
43    itertools::chain,
44    paste::paste,
45    pin_project::pin_project,
46    serde::{Deserialize, Serialize},
47    slotmap_careful::SlotMap,
48    static_assertions::assert_not_impl_any,
49    thiserror::Error,
50    tracing::{debug, error, info},
51    void::{ResultVoidExt as _, Void},
52};
53
54pub(crate) use {
55    tor_async_utils::mpsc_channel_no_memquota,
56    tor_async_utils::stream_peek::StreamUnobtrusivePeeker,
57    tor_basic_utils::ByteQty as Qty,
58    tor_config::{ConfigBuildError, ReconfigureError},
59    tor_error::{error_report, internal, into_internal, trace_report, Bug, ErrorKind, HasKind},
60    tor_log_ratelim::log_ratelim,
61    tor_rtcompat::{CoarseInstant, CoarseTimeProvider, DynTimeProvider},
62};
63
64pub(crate) use crate::{
65    config::{Config, ConfigInner},
66    drop_bomb::{DropBomb, DropBombCondition},
67    drop_reentrancy,
68    error::{Error, ReclaimCrashed, StartupError, TrackerCorrupted},
69    if_enabled::{EnabledToken, IfEnabled},
70    memory_cost::{HasMemoryCost, HasTypedMemoryCost, TypedParticipation},
71    mtracker::{self, Account, IsParticipant, MemoryQuotaTracker, Participation},
72    private::Sealed,
73    refcount,
74    utils::DefaultExtTake,
75};