bitcoin-epoch 0.1.18

RAII-style guard for using epoch-based graph traversal algorithms
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// ---------------- [ File: bitcoin-epoch/src/with_fresh_epoch.rs ]
crate::ix!();

/// Convenience macro mirroring the original C++
/// `WITH_FRESH_EPOCH` helper.
///
/// ```text
/// {
///     with_fresh_epoch!(mempool_epoch);
///     … // traversal
/// }   // guard dropped here
/// ```
#[macro_export]
macro_rules! with_fresh_epoch {
    ($epoch:expr) => {
        let _epoch_guard = $crate::EpochGuard::new($epoch.clone());
    };
}