diff --git a/src/pb/sample.rs b/src/pb/sample.rs index 54dea90..6945105 100644 --- a/src/pb/sample.rs +++ b/src/pb/sample.rs @@ -6,6 +6,16 @@ use super::Publisher; use std::ops::{Deref, DerefMut}; +/// # Safety +/// +/// This is a marker trait for types that can be transferred via shared memory. +/// The types must satisfy the following conditions: +/// - no heap is used +/// - the data structure is entirely contained in the shared memory - no pointers +/// to process local memory, no references to process local constructs, no dynamic allocators +/// - the data structure has to be relocatable and therefore must not internally +/// use pointers/references +/// In general, types that could implement the Copy trait fulfill these requirements. pub unsafe trait POD {} // TODO more impls unsafe impl POD for i8 {}