summaryrefslogtreecommitdiff
path: root/crates/tor-memquota/src/utils.rs
blob: 1bede7b0972c9bc88bb4a16ab878ce54b6d68173 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
//! Miscellanous 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)
    }
}