1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
use crate::{ReadApi, RwApi, WriteApi};

impl<T, R> RwApi for T
    where
        T: ReadApi<Target=R> + WriteApi<Target=R>
{
    type ReadGuard<'a> = <Self as ReadApi>::ReadGuard<'a>
        where Self: 'a;
    type WriteGuard<'a> = <Self as WriteApi>::WriteGuard<'a>
        where Self: 'a;

    #[inline]
    fn read(&self) -> Self::ReadGuard<'_> {
        ReadApi::read(self)
    }

    #[inline]
    fn write(&mut self) -> Self::WriteGuard<'_> {
        WriteApi::write(self)
    }
}