oi_pkg_checker_core/
packages.rs

1pub mod components;
2mod cycles;
3mod de_serialization;
4pub mod depend_types;
5pub mod dependency_type;
6pub mod package;
7pub mod rev_depend_type;
8
9#[macro_export]
10#[cfg(not(feature = "thread_safe"))]
11macro_rules! shared_type {
12    ($t:ty) => {
13        std::rc::Rc<std::cell::RefCell<$t>>
14    };
15}
16
17#[macro_export]
18#[cfg(not(feature = "thread_safe"))]
19macro_rules! weak_type {
20    ($t:ty) => {
21        std::rc::Weak<std::cell::RefCell<$t>>
22    };
23}
24
25#[macro_export]
26#[cfg(not(feature = "thread_safe"))]
27macro_rules! new {
28    ($t:expr) => {
29        std::rc::Rc::new(std::cell::RefCell::new($t))
30    };
31}
32
33#[macro_export]
34#[cfg(not(feature = "thread_safe"))]
35macro_rules! clone {
36    ($t:expr) => {
37        std::rc::Rc::clone($t)
38    };
39}
40
41#[macro_export]
42#[cfg(not(feature = "thread_safe"))]
43macro_rules! downgrade {
44    ($t:expr) => {
45        std::rc::Rc::downgrade($t)
46    };
47}
48
49#[macro_export]
50#[cfg(not(feature = "thread_safe"))]
51macro_rules! get {
52    ($shared:expr) => {
53        $shared.borrow()
54    };
55}
56
57#[macro_export]
58#[cfg(not(feature = "thread_safe"))]
59macro_rules! get_mut {
60    ($shared:expr) => {
61        $shared.borrow_mut()
62    };
63}
64
65#[macro_export]
66#[cfg(feature = "thread_safe")]
67macro_rules! shared_type {
68    ($t:ty) => {
69        std::sync::Arc<std::sync::Mutex<$t>>
70    };
71}
72
73#[macro_export]
74#[cfg(feature = "thread_safe")]
75macro_rules! weak_type {
76    ($t:ty) => {
77        std::sync::Weak<std::sync::Mutex<$t>>
78    };
79}
80
81#[macro_export]
82#[cfg(feature = "thread_safe")]
83macro_rules! new {
84    ($t:expr) => {
85        std::sync::Arc::new(std::sync::Mutex::new($t))
86    };
87}
88
89#[macro_export]
90#[cfg(feature = "thread_safe")]
91macro_rules! clone {
92    ($t:expr) => {
93        std::sync::Arc::clone($t)
94    };
95}
96
97#[macro_export]
98#[cfg(feature = "thread_safe")]
99macro_rules! downgrade {
100    ($t:expr) => {
101        std::sync::Arc::downgrade($t)
102    };
103}
104
105#[macro_export]
106#[cfg(feature = "thread_safe")]
107macro_rules! get {
108    ($shared:expr) => {
109        $shared.lock().unwrap()
110    };
111}
112
113#[macro_export]
114#[cfg(feature = "thread_safe")]
115macro_rules! get_mut {
116    ($shared:expr) => {
117        get!($shared)
118    };
119}