1extern crate stable_deref_trait;
18
19use std::ops::{Deref, DerefMut};
20use stable_deref_trait::StableDeref;
21
22#[macro_use]
23mod rc_macros;
24
25pub mod aref;
26pub mod rmba;
27mod rc_bitmask;
28pub mod rc;
29pub mod arc;
30
31pub use crate::aref::ARef as ARef;
32pub use crate::aref::ARefs as ARefs;
33pub use crate::aref::ARefss as ARefss;
34pub use crate::rmba::RMBA as RMBA;
35
36pub mod rc1 {
38 pub type RCell<T> = crate::rc::RCell<T, u8>;
39 pub type Ref<T> = crate::rc::Ref<T, u8>;
40 pub type RefMut<T> = crate::rc::RefMut<T, u8>;
41 pub type Strong<T> = crate::rc::Strong<T, u8>;
42 pub type Weak<T> = crate::rc::Weak<T, u8>;
43}
44
45pub mod rc2 {
47 pub type RCell<T> = crate::rc::RCell<T, u16>;
48 pub type Ref<T> = crate::rc::Ref<T, u16>;
49 pub type RefMut<T> = crate::rc::RefMut<T, u16>;
50 pub type Strong<T> = crate::rc::Strong<T, u16>;
51 pub type Weak<T> = crate::rc::Weak<T, u16>;
52}
53
54pub mod rc4 {
56 pub type RCell<T> = crate::rc::RCell<T, u32>;
57 pub type Ref<T> = crate::rc::Ref<T, u32>;
58 pub type RefMut<T> = crate::rc::RefMut<T, u32>;
59 pub type Strong<T> = crate::rc::Strong<T, u32>;
60 pub type Weak<T> = crate::rc::Weak<T, u32>;
61}
62
63pub mod arcu {
65 pub type Ref<T> = crate::arc::Ref<T, usize>;
66 pub type RefMut<T> = crate::arc::RefMut<T, usize>;
67 pub type Strong<T> = crate::arc::Strong<T, usize>;
68 pub type Weak<T> = crate::arc::Weak<T, usize>;
69}
70
71
72pub mod rc8 {
74 pub type RCell<T> = crate::rc::RCell<T, u64>;
75 pub type Ref<T> = crate::rc::Ref<T, u64>;
76 pub type RefMut<T> = crate::rc::RefMut<T, u64>;
77 pub type Strong<T> = crate::rc::Strong<T, u64>;
78 pub type Weak<T> = crate::rc::Weak<T, u64>;
79}
80
81pub mod rc16 {
83 pub type RCell<T> = crate::rc::RCell<T, u128>;
84 pub type Ref<T> = crate::rc::Ref<T, u128>;
85 pub type RefMut<T> = crate::rc::RefMut<T, u128>;
86 pub type Strong<T> = crate::rc::Strong<T, u128>;
87 pub type Weak<T> = crate::rc::Weak<T, u128>;
88}
89
90
91#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
98pub struct Bx<T: ?Sized>(Box<T>);
99
100impl<T> Bx<T> {
101 pub fn new(t: T) -> Bx<T> { Bx(Box::new(t)) }
102}
103
104impl<T: ?Sized> From<Box<T>> for Bx<T> {
105 fn from(t: Box<T>) -> Bx<T> { Bx(t) }
106}
107
108impl<T: ?Sized> Deref for Bx<T> {
109 type Target = T;
110 #[inline]
111 fn deref(&self) -> &T { &self.0 }
112}
113
114unsafe impl<T: ?Sized> StableDeref for Bx<T> {}
115
116#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
123pub struct Bxm<T: ?Sized>(Box<T>);
124
125impl<T> Bxm<T> {
126 pub fn new(t: T) -> Bxm<T> { Bxm(Box::new(t)) }
127}
128
129impl<T: ?Sized> From<Box<T>> for Bxm<T> {
130 fn from(t: Box<T>) -> Bxm<T> { Bxm(t) }
131}
132
133impl<T: ?Sized> Deref for Bxm<T> {
134 type Target = T;
135 #[inline]
136 fn deref(&self) -> &T { &self.0 }
137}
138
139impl<T: ?Sized> DerefMut for Bxm<T> {
140 #[inline]
141 fn deref_mut(&mut self) -> &mut T { &mut self.0 }
142}
143
144unsafe impl<T: ?Sized> StableDeref for Bxm<T> {}
145