Sha256: bfaaf5a0c78d7088241e9ad725044233f10c8701d3b3a95d311cbc087e611c96

Contents?: true

Size: 964 Bytes

Versions: 29

Compression:

Stored size: 964 Bytes

Contents

use std::ops;

use crate::sys;

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

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

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

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

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

Version data entries

29 entries across 29 versions & 1 rubygems

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