1#[derive(Debug, Clone, PartialEq, Eq)]
2pub enum GcError {
3 AllocationFailed,
5 InvalidReference,
7 PartitionFull,
9 PartitionNotFound,
11 PartitionNotEmpty,
13}
14
15pub type GcResult<T> = Result<T, GcError>;
16
17#[inline(always)]
18pub(crate) const fn unlikely(expr: bool) -> bool {
19 if expr {
20 #[cold]
21 const fn cold_path() -> bool {
22 true
23 }
24 cold_path()
25 } else {
26 false
27 }
28}
29
30#[macro_export]
31macro_rules! gc_type_register {
32 ( $( $ty:ty $(, drop_pass = $pass:expr)?; )+ ) => {
33 $crate::gc_type_table_internal! {
34 crate_path = $crate;
35 $( $ty $(, drop_pass = $pass)?; )+
36 }
37 };
38}