Sha256: 67ecad5f86f918d29b749096ed2b176985af428be6a08eb8a2bdc6edbae29393
Contents?: true
Size: 692 Bytes
Versions: 20
Compression:
Stored size: 692 Bytes
Contents
use rustix::fd::AsFd; use rustix::fs::FlockOperation; use std::ops; use super::{compatible_unix_lock, RwLock}; #[derive(Debug)] pub struct RwLockReadGuard<'lock, T: AsFd> { lock: &'lock RwLock<T>, } impl<'lock, T: AsFd> RwLockReadGuard<'lock, T> { pub(crate) fn new(lock: &'lock RwLock<T>) -> Self { Self { lock } } } impl<T: AsFd> ops::Deref for RwLockReadGuard<'_, T> { type Target = T; #[inline] fn deref(&self) -> &Self::Target { &self.lock.inner } } impl<T: AsFd> Drop for RwLockReadGuard<'_, T> { #[inline] fn drop(&mut self) { let _ = compatible_unix_lock(self.lock.inner.as_fd(), FlockOperation::Unlock).ok(); } }
Version data entries
20 entries across 20 versions & 1 rubygems