neon/sys/
debug_send_wrapper.rs1pub(super) use wrapper::DebugSendWrapper;
5
6#[cfg(debug_assertions)]
7mod wrapper {
8 use std::ops::Deref;
9
10 #[repr(transparent)]
11 pub struct DebugSendWrapper<T>(send_wrapper::SendWrapper<T>);
12
13 impl<T> DebugSendWrapper<T> {
14 pub fn new(value: T) -> Self {
15 Self(send_wrapper::SendWrapper::new(value))
16 }
17
18 pub fn take(self) -> T {
19 self.0.take()
20 }
21 }
22
23 impl<T> Deref for DebugSendWrapper<T> {
24 type Target = T;
25
26 fn deref(&self) -> &Self::Target {
27 &self.0
28 }
29 }
30}
31
32#[cfg(not(debug_assertions))]
33mod wrapper {
34 use std::ops::Deref;
35
36 #[repr(transparent)]
37 pub struct DebugSendWrapper<T>(T);
38
39 impl<T> DebugSendWrapper<T> {
40 pub fn new(value: T) -> Self {
41 Self(value)
42 }
43
44 pub fn take(self) -> T {
45 self.0
46 }
47 }
48
49 impl<T> Deref for DebugSendWrapper<T> {
50 type Target = T;
51
52 fn deref(&self) -> &Self::Target {
53 &self.0
54 }
55 }
56}