use std::ops;
use crate::sys;
#[must_use = "if unused the RwLock will immediately unlock"]
#[derive(Debug)]
pub struct RwLockReadGuard<'lock, T: sys::AsRaw> {
guard: sys::RwLockReadGuard<'lock, T>,
}
impl<'lock, T: sys::AsRaw> RwLockReadGuard<'lock, T> {
pub(crate) fn new(guard: sys::RwLockReadGuard<'lock, T>) -> Self {
Self { guard }
}
}
impl<T: sys::AsRaw> ops::Deref for RwLockReadGuard<'_, T> {
type Target = T;
#[inline]
fn deref(&self) -> &Self::Target {
self.guard.deref()
}
}
impl<T: sys::AsRaw> Drop for RwLockReadGuard<'_, T> {
#[inline]
fn drop(&mut self) {}
}