Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions hdf5-types/src/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,11 @@ impl<T: Copy + fmt::Debug> fmt::Debug for VarLenArray<T> {
}
}

// Safety: Memory backed by `VarLenArray` can be accessed and freed from any thread
unsafe impl<T: Copy + Send> Send for VarLenArray<T> {}
// Safety: `VarLenArray` has no interior mutability
unsafe impl<T: Copy + Sync> Sync for VarLenArray<T> {}

#[cfg(test)]
pub mod tests {
use super::VarLenArray;
Expand Down
10 changes: 10 additions & 0 deletions hdf5-types/src/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down Expand Up @@ -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)]
Expand Down