triomphe/
arc_swap_support.rs1use arc_swap::RefCnt;
2
3use crate::{Arc, ThinArc};
4use core::ffi::c_void;
5
6unsafe impl<H, T> RefCnt for ThinArc<H, T> {
7 type Base = c_void;
8
9 #[inline]
10 fn into_ptr(me: Self) -> *mut Self::Base {
11 ThinArc::into_raw(me) as *mut _
12 }
13
14 #[inline]
15 fn as_ptr(me: &Self) -> *mut Self::Base {
16 ThinArc::as_ptr(me) as *mut _
17 }
18
19 #[inline]
20 unsafe fn from_ptr(ptr: *const Self::Base) -> Self {
21 ThinArc::from_raw(ptr)
22 }
23}
24
25unsafe impl<T> RefCnt for Arc<T> {
26 type Base = T;
27
28 #[inline]
29 fn into_ptr(me: Self) -> *mut Self::Base {
30 Arc::into_raw(me) as *mut _
31 }
32
33 #[inline]
34 fn as_ptr(me: &Self) -> *mut Self::Base {
35 Arc::as_ptr(me) as *mut _
36 }
37
38 #[inline]
39 unsafe fn from_ptr(ptr: *const Self::Base) -> Self {
40 Arc::from_raw(ptr)
41 }
42}