From 27fceeabca80b24ee15586f9363b8b4cb373d909 Mon Sep 17 00:00:00 2001 From: Mathias Kraus Date: Fri, 24 Jun 2022 02:01:20 +0200 Subject: [PATCH] iox-#5 Fix clippy warning for unsafe trait --- src/pb/sample.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) 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 {}