1use std::ops;
2
3use crate::sys;
4
5#[must_use = "if unused the RwLock will immediately unlock"]
15#[derive(Debug)]
16pub struct RwLockReadGuard<'lock, T: sys::AsOpenFile> {
17 guard: sys::RwLockReadGuard<'lock, T>,
18}
19
20impl<'lock, T: sys::AsOpenFile> RwLockReadGuard<'lock, T> {
21 pub(crate) fn new(guard: sys::RwLockReadGuard<'lock, T>) -> Self {
22 Self { guard }
23 }
24}
25
26impl<T: sys::AsOpenFile> ops::Deref for RwLockReadGuard<'_, T> {
27 type Target = T;
28
29 #[inline]
30 fn deref(&self) -> &Self::Target {
31 self.guard.deref()
32 }
33}
34
35impl<T: sys::AsOpenFile> Drop for RwLockReadGuard<'_, T> {
37 #[inline]
38 fn drop(&mut self) {}
39}