1mod hybrid;
2#[cfg(feature = "track_threads")]
3mod hybrid_threads;
4mod regular;
5
6use crate::FlexRcInner;
7
8pub use hybrid::*;
9pub use regular::*;
10
11pub trait Algorithm<META, META2> {
12 fn create() -> Self;
14
15 fn is_unique(&self) -> bool;
17
18 fn clone(&self);
20
21 fn drop(&self) -> bool;
23
24 fn try_into_other<T: ?Sized>(
26 &self,
27 inner: *mut FlexRcInner<META, META2, T>,
28 ) -> Result<*mut FlexRcInner<META2, META, T>, *mut FlexRcInner<META, META2, T>>;
29
30 fn try_to_other<T: ?Sized>(
32 &self,
33 inner: *mut FlexRcInner<META, META2, T>,
34 ) -> Result<*mut FlexRcInner<META2, META, T>, *mut FlexRcInner<META, META2, T>>;
35}
36
37#[cfg(feature = "std")]
38#[inline]
39fn abort() {
40 std::process::abort()
41}
42
43#[cfg(not(feature = "std"))]
44#[inline]
45fn abort() {
46 panic!("Reference count overflow");
48}