Sha256: 0492fff1b5fc58ade6749ffd5f23900c465590c66ac3f9a5f0ad126d60038b87

Contents?: true

Size: 1.13 KB

Versions: 31

Compression:

Stored size: 1.13 KB

Contents

use std::ops;

use crate::sys;

/// RAII structure used to release the exclusive write access of a lock when
/// dropped.
///
/// This structure is created by the [`write`] and [`try_write`] methods
/// on [`RwLock`].
///
/// [`write`]: crate::RwLock::write
/// [`try_write`]: crate::RwLock::try_write
/// [`RwLock`]: crate::RwLock
#[must_use = "if unused the RwLock will immediately unlock"]
#[derive(Debug)]
pub struct RwLockWriteGuard<'lock, T: sys::AsOpenFile> {
    guard: sys::RwLockWriteGuard<'lock, T>,
}

impl<'lock, T: sys::AsOpenFile> RwLockWriteGuard<'lock, T> {
    pub(crate) fn new(guard: sys::RwLockWriteGuard<'lock, T>) -> Self {
        Self { guard }
    }
}

impl<T: sys::AsOpenFile> ops::Deref for RwLockWriteGuard<'_, T> {
    type Target = T;

    #[inline]
    fn deref(&self) -> &Self::Target {
        self.guard.deref()
    }
}

impl<T: sys::AsOpenFile> ops::DerefMut for RwLockWriteGuard<'_, T> {
    #[inline]
    fn deref_mut(&mut self) -> &mut Self::Target {
        self.guard.deref_mut()
    }
}

/// Release the lock.
impl<T: sys::AsOpenFile> Drop for RwLockWriteGuard<'_, T> {
    #[inline]
    fn drop(&mut self) {}
}

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
wasmtime-30.0.2 ./ext/cargo-vendor/fd-lock-4.0.2/src/write_guard.rs
wasmtime-29.0.0 ./ext/cargo-vendor/fd-lock-4.0.2/src/write_guard.rs
wasmtime-28.0.0 ./ext/cargo-vendor/fd-lock-4.0.2/src/write_guard.rs
wasmtime-27.0.0 ./ext/cargo-vendor/fd-lock-4.0.2/src/write_guard.rs
wasmtime-26.0.0 ./ext/cargo-vendor/fd-lock-4.0.2/src/write_guard.rs
wasmtime-25.0.2 ./ext/cargo-vendor/fd-lock-4.0.2/src/write_guard.rs
wasmtime-25.0.1 ./ext/cargo-vendor/fd-lock-4.0.2/src/write_guard.rs
wasmtime-25.0.0 ./ext/cargo-vendor/fd-lock-4.0.2/src/write_guard.rs
wasmtime-24.0.0 ./ext/cargo-vendor/fd-lock-4.0.2/src/write_guard.rs
wasmtime-23.0.2 ./ext/cargo-vendor/fd-lock-4.0.2/src/write_guard.rs
wasmtime-22.0.0 ./ext/cargo-vendor/fd-lock-4.0.2/src/write_guard.rs
wasmtime-21.0.1 ./ext/cargo-vendor/fd-lock-4.0.2/src/write_guard.rs
wasmtime-20.0.2 ./ext/cargo-vendor/fd-lock-4.0.2/src/write_guard.rs
wasmtime-20.0.0 ./ext/cargo-vendor/fd-lock-4.0.2/src/write_guard.rs
wasmtime-18.0.3 ./ext/cargo-vendor/fd-lock-4.0.2/src/write_guard.rs
wasmtime-17.0.1 ./ext/cargo-vendor/fd-lock-4.0.2/src/write_guard.rs
wasmtime-17.0.0 ./ext/cargo-vendor/fd-lock-4.0.2/src/write_guard.rs
wasmtime-16.0.0 ./ext/cargo-vendor/fd-lock-4.0.2/src/write_guard.rs
wasmtime-15.0.1 ./ext/cargo-vendor/fd-lock-4.0.2/src/write_guard.rs
wasmtime-15.0.0 ./ext/cargo-vendor/fd-lock-4.0.2/src/write_guard.rs