labview_interop/memory/
mod.rs1#[cfg(feature = "link")]
6mod owned_handle;
7mod uhandle;
8mod uptr;
9
10use std::fmt::Debug;
11
12pub trait LVCopy {}
18
19impl<T: Copy> LVCopy for T {}
21
22#[derive(Clone, Copy, PartialEq, Eq, Debug)]
24#[repr(transparent)]
25#[doc(hidden)]
26pub struct MagicCookie(u32);
27
28#[cfg(feature = "link")]
29pub use owned_handle::OwnedUHandle;
30pub use uhandle::UHandle;
31pub use uptr::UPtr;
32
33fn fmt_handle<T: Debug + ?Sized>(
35 label: &str,
36 handle: &UHandle<T>,
37 f: &mut std::fmt::Formatter<'_>,
38) -> std::fmt::Result {
39 match unsafe { handle.as_ref() } {
40 Ok(inner) => write!(f, "{label}({inner:?})"),
41 Err(_) => write!(f, "{label}(Invalid)"),
42 }
43}