1use std::marker::PhantomData;
2
3pub trait PlugLifetime<'a> {
4 type Type;
5}
6
7pub struct H1MutexLockGuard<T>(PhantomData<T>);
8
9impl<'a, T> PlugLifetime<'a> for H1MutexLockGuard<T>
10where
11 T: 'static,
12{
13 type Type = std::sync::MutexGuard<'a, T>;
14}
15
16#[cfg(feature = "tokio")]
17pub struct H1TokioMutexLockGuard<T>(PhantomData<T>);
18
19#[cfg(feature = "tokio")]
20impl<'a, T> PlugLifetime<'a> for H1TokioMutexLockGuard<T>
21where
22 T: 'static,
23{
24 type Type = tokio::sync::MutexGuard<'a, T>;
25}
26
27pub struct H1RwLockReadGuard<T>(PhantomData<T>);
28
29impl<'a, T> PlugLifetime<'a> for H1RwLockReadGuard<T>
30where
31 T: 'static,
32{
33 type Type = std::sync::RwLockReadGuard<'a, T>;
34}
35
36pub struct H1RwLockWriteGuard<T>(PhantomData<T>);
37
38impl<'a, T> PlugLifetime<'a> for H1RwLockWriteGuard<T>
39where
40 T: 'static,
41{
42 type Type = std::sync::RwLockWriteGuard<'a, T>;
43}
44
45#[cfg(feature = "tokio")]
46pub struct H1TokioRwLockReadGuard<T>(PhantomData<T>);
47
48#[cfg(feature = "tokio")]
49impl<'a, T> PlugLifetime<'a> for H1TokioRwLockReadGuard<T>
50where
51 T: 'static,
52{
53 type Type = tokio::sync::RwLockReadGuard<'a, T>;
54}
55
56#[cfg(feature = "tokio")]
57pub struct H1TokioRwLockWriteGuard<T>(PhantomData<T>);
58
59#[cfg(feature = "tokio")]
60impl<'a, T> PlugLifetime<'a> for H1TokioRwLockWriteGuard<T>
61where
62 T: 'static,
63{
64 type Type = tokio::sync::RwLockWriteGuard<'a, T>;
65}