Implement From<Unique<T>> for Shared<T>
This commit is contained in:
parent
ddaf9b24f0
commit
1ef24bb3e2
1 changed files with 8 additions and 0 deletions
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
#![stable(feature = "rust1", since = "1.0.0")]
|
||||
|
||||
use convert::From;
|
||||
use intrinsics;
|
||||
use ops::CoerceUnsized;
|
||||
use fmt;
|
||||
|
|
@ -1288,3 +1289,10 @@ impl<T: ?Sized> fmt::Pointer for Shared<T> {
|
|||
fmt::Pointer::fmt(&self.as_ptr(), f)
|
||||
}
|
||||
}
|
||||
|
||||
#[unstable(feature = "shared", issue = "27730")]
|
||||
impl<T: ?Sized> From<Unique<T>> for Shared<T> {
|
||||
fn from(unique: Unique<T>) -> Self {
|
||||
Shared { pointer: unique.pointer, _marker: PhantomData }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue