-
Notifications
You must be signed in to change notification settings - Fork 474
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
701: Add {Atomic, Shared}::try_into_owned r=taiki-e a=PatrickNorton Sometimes, I have run into times when I have had an `Atomic` which I know to be either null or valid, and I want to convert it into an `Owned`. As far as I can tell, there is no way to do this without converting through a `Shared`, which comes at the const of an additional atomic load. This pull request also adds the same method to `Shared` for symmetry. This pull request adds the following methods: ```rust impl<T: ?Sized + Pointable> Owned<T> { pub unsafe fn try_into_owned(self) -> Option<Owned<T>>; } impl<T: ?Sized + Pointable> Shared<'_, T> { pub unsafe fn try_into_owned(self) -> Option<Owned<T>>; } ``` Co-authored-by: Patrick Norton <[email protected]>
- Loading branch information
Showing
1 changed file
with
76 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters