Skip to content

Commit

Permalink
Adds Send/Sync implementations for SlimmerBox
Browse files Browse the repository at this point in the history
(whenever inner types implement them)
Fixes #3
  • Loading branch information
Qqwy committed Nov 13, 2023
1 parent d33f04f commit 945d4f8
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,23 @@ where
}
}

// unsafe impl<T, SlimmerMetadata> Send for SlimmerBox<T, SlimmerMetadata> {}
// unsafe impl<T, SlimmerMetadata> Sync for SlimmerBox<T, SlimmerMetadata> {}

unsafe impl<T: Send, SlimmerMetadata: Send> Send for SlimmerBox<T, SlimmerMetadata>
where
T: ?Sized,
T: SlimmerPointee<SlimmerMetadata>,
SlimmerMetadata: TryFrom<<T as Pointee>::Metadata> + TryInto<<T as Pointee>::Metadata> + Copy,
{}

unsafe impl<T: Sync, SlimmerMetadata: Sync> Sync for SlimmerBox<T, SlimmerMetadata>
where
T: ?Sized,
T: SlimmerPointee<SlimmerMetadata>,
SlimmerMetadata: TryFrom<<T as Pointee>::Metadata> + TryInto<<T as Pointee>::Metadata> + Copy,
{}

impl<T, SlimmerMetadata> Drop for SlimmerBox<T, SlimmerMetadata>
where
T: ?Sized,
Expand Down

0 comments on commit 945d4f8

Please sign in to comment.