Skip to content

Commit

Permalink
Fix Sync and Send markers, add Unpin (#39)
Browse files Browse the repository at this point in the history
* Fix Sync and Send markers, add Unpin

* rustfmt
  • Loading branch information
maciejhirsz authored Jan 26, 2021
1 parent 8e970aa commit 175938a
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "beef"
version = "0.4.4"
version = "0.5.0"
authors = ["Maciej Hirsz <hello@maciej.codes>"]
edition = "2018"
description = "More compact Cow"
Expand Down
25 changes: 23 additions & 2 deletions src/generic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -528,5 +528,26 @@ where
}

// Safety: Same bounds as `std::borrow::Cow`.
unsafe impl<T: Beef + Sync + ?Sized, U: Capacity> Sync for Cow<'_, T, U> {}
unsafe impl<T: Beef + Send + Sync + ?Sized, U: Capacity> Send for Cow<'_, T, U> {}
unsafe impl<T, U> Sync for Cow<'_, T, U>
where
U: Capacity,
T: Beef + Sync + ?Sized,
T::Owned: Sync,
{
}

unsafe impl<T, U> Send for Cow<'_, T, U>
where
U: Capacity,
T: Beef + Sync + ?Sized,
T::Owned: Send,
{
}

impl<T, U> Unpin for Cow<'_, T, U>
where
U: Capacity,
T: Beef + ?Sized,
T::Owned: Unpin,
{
}

0 comments on commit 175938a

Please sign in to comment.