summaryrefslogtreecommitdiff
path: root/crates/tor-memquota/src/utils.rs
blob: fa2de39658a8d4aaa0fee4fdb82f8959a4054733 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
//! Miscellaneous internal utilities

use crate::internal_prelude::*;

/// Convenience extension trait to provide `.take()`
///
/// Convenient way to provide `.take()` on some of our types.
pub(crate) trait DefaultExtTake: Default {
    /// Returns `*self`, replacing it with the default value.
    fn take(&mut self) -> Self {
        mem::take(self)
    }
}