Skip to content
Merged
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
8 changes: 8 additions & 0 deletions src/chunks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,10 @@ pub struct WriteChunkUninit<'a, T> {
producer: &'a Producer<T>,
}

// WriteChunkUninit only exists while a unique reference to the Producer is held.
// It is therefore safe to move it to another thread.
unsafe impl<T: Send> Send for WriteChunkUninit<'_, T> {}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about adding a comment regarding safety?

Maybe something like this:

// WriteChunkUninit only exists while a unique reference to the Producer is held.
// It is therefore safe to move it to another thread.


impl<T> WriteChunkUninit<'_, T> {
/// Returns two slices for writing to the requested slots.
///
Expand Down Expand Up @@ -614,6 +618,10 @@ pub struct ReadChunk<'a, T> {
consumer: &'a mut Consumer<T>,
}

// ReadChunk only exists while a unique reference to the Consumer is held.
// It is therefore safe to move it to another thread.
unsafe impl<T: Send> Send for ReadChunk<'_, T> {}

impl<T> ReadChunk<'_, T> {
/// Returns two slices for reading from the requested slots.
///
Expand Down