1use crate::{plug::PlugType, Rcb, WeakRcb};
4use std::sync::{Arc, Weak};
5
6pub struct H1Arc;
8
9impl<T> PlugType<T> for H1Arc {
10 type T = Arc<T>;
11}
12
13pub struct H1Weak;
15
16impl<T> PlugType<T> for H1Weak {
17 type T = Weak<T>;
18}
19
20impl<T> Rcb<T> for Arc<T> {
21 type Weak = Weak<T>;
22
23 fn new(x: T) -> Self {
24 Arc::<T>::new(x)
25 }
26
27 fn try_unwrap(this: Self) -> Result<T, Self> {
28 Arc::<T>::try_unwrap(this)
29 }
30
31 fn downgrade(this: &Self) -> Self::Weak {
32 Arc::<T>::downgrade(this)
33 }
34}
35
36impl<T> WeakRcb<T> for Weak<T> {
37 type Strong = Arc<T>;
38
39 fn upgrade(&self) -> Option<Self::Strong> {
40 Weak::<T>::upgrade(self)
41 }
42}