diff --git a/hdf5-types/src/array.rs b/hdf5-types/src/array.rs index f5b8956c5..cf0909246 100644 --- a/hdf5-types/src/array.rs +++ b/hdf5-types/src/array.rs @@ -142,6 +142,11 @@ impl fmt::Debug for VarLenArray { } } +// Safety: Memory backed by `VarLenArray` can be accessed and freed from any thread +unsafe impl Send for VarLenArray {} +// Safety: `VarLenArray` has no interior mutability +unsafe impl Sync for VarLenArray {} + #[cfg(test)] pub mod tests { use super::VarLenArray; diff --git a/hdf5-types/src/string.rs b/hdf5-types/src/string.rs index 5f587f500..612f462c7 100644 --- a/hdf5-types/src/string.rs +++ b/hdf5-types/src/string.rs @@ -282,6 +282,11 @@ impl AsAsciiStr for VarLenAscii { } } +// Safety: Memory backed by `VarLenAscii` can be accessed and freed from any thread +unsafe impl Send for VarLenAscii {} +// Safety: `VarLenAscii` has no interior mutability +unsafe impl Sync for VarLenAscii {} + // ================================================================================ #[repr(C)] @@ -371,6 +376,11 @@ impl FromStr for VarLenUnicode { } } +// Safety: Memory backed by `VarLenUnicode` can be accessed and freed from any thread +unsafe impl Send for VarLenUnicode {} +// Safety: `VarLenUnicode` has no interior mutability +unsafe impl Sync for VarLenUnicode {} + // ================================================================================ #[repr(C)]