zccache 1.11.4

Local-first compiler cache for C/C++/Rust/Emscripten
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//! RAII guard for tracking in-flight artifact persistence bytes.

use super::*;

/// RAII guard that decrements `in_flight_bytes` on drop, even during panic unwind.
/// Prevents permanent counter inflation if a `spawn_blocking` task panics.
pub(super) struct InFlightGuard {
    pub(super) state: Arc<SharedState>,
    pub(super) size: usize,
}

impl Drop for InFlightGuard {
    fn drop(&mut self) {
        self.state
            .in_flight_bytes
            .fetch_sub(self.size, Ordering::Relaxed);
    }
}