Skip to content

Commit

Permalink
Impl Send/Sync for IntoIter (#368)
Browse files Browse the repository at this point in the history
Closes #367.
  • Loading branch information
mbrubeck authored Jan 15, 2025
1 parent a176a87 commit 1289db6
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,11 @@ pub struct IntoIter<T, const N: usize> {
_marker: PhantomData<T>,
}

// SAFETY: IntoIter has unique ownership of its contents. Sending (or sharing) an `IntoIter<T, N>`
// is equivalent to sending (or sharing) a `SmallVec<T, N>`.
unsafe impl<T, const N: usize> Send for IntoIter<T, N> where T: Send {}
unsafe impl<T, const N: usize> Sync for IntoIter<T, N> where T: Sync {}

impl<T, const N: usize> IntoIter<T, N> {
#[inline]
const fn is_zst() -> bool {
Expand Down

0 comments on commit 1289db6

Please sign in to comment.