Skip to content

Commit

Permalink
Merge pull request #4 from Qqwy/3-send_and_sync_for_box
Browse files Browse the repository at this point in the history
Adds Send/Sync implementations for SlimmerBox
  • Loading branch information
Qqwy authored Nov 13, 2023
2 parents d33f04f + 56896eb commit e338ea1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "slimmer_box"
version = "0.6.4"
version = "0.6.5"
edition = "2021"
license = "MIT"
authors = ["Qqwy / Marten"]
Expand Down
14 changes: 14 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,20 @@ where
}
}

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 e338ea1

Please sign in to comment.