Skip to content

Commit

Permalink
add Send and Sync impls for ComPtr and ComRef
Browse files Browse the repository at this point in the history
Add Send and Sync impls for ComPtr and ComRef with the same bounds as
the Send and Sync impls for Arc in the standard library.
  • Loading branch information
glowcoil committed Apr 30, 2024
1 parent fd36480 commit 1a44719
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions com-scrape-types/src/ptr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ impl<'a, I: Interface> Clone for ComRef<'a, I> {
}
}

unsafe impl<'a, I: Interface> Send for ComRef<'a, I> where I: Sync + Send {}

unsafe impl<'a, I: Interface> Sync for ComRef<'a, I> where I: Sync + Send {}

impl<'a, I: Interface> ComRef<'a, I> {
/// Gets the wrapped interface pointer.
///
Expand Down Expand Up @@ -192,6 +196,10 @@ impl<I: Interface> Clone for ComPtr<I> {
}
}

unsafe impl<I: Interface> Send for ComPtr<I> where I: Sync + Send {}

unsafe impl<I: Interface> Sync for ComPtr<I> where I: Sync + Send {}

impl<I: Interface> Drop for ComPtr<I> {
#[inline]
fn drop(&mut self) {
Expand Down

0 comments on commit 1a44719

Please sign in to comment.