Implemented BorrowFrom<Rc<T>> for T.
This commit is contained in:
@@ -141,6 +141,7 @@
|
|||||||
|
|
||||||
#![stable]
|
#![stable]
|
||||||
|
|
||||||
|
use core::borrow::BorrowFrom;
|
||||||
use core::cell::Cell;
|
use core::cell::Cell;
|
||||||
use core::clone::Clone;
|
use core::clone::Clone;
|
||||||
use core::cmp::{PartialEq, PartialOrd, Eq, Ord, Ordering};
|
use core::cmp::{PartialEq, PartialOrd, Eq, Ord, Ordering};
|
||||||
@@ -349,6 +350,12 @@ impl<T: Clone> Rc<T> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<T> BorrowFrom<Rc<T>> for T {
|
||||||
|
fn borrow_from(owned: &Rc<T>) -> &T {
|
||||||
|
&**owned
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[experimental = "Deref is experimental."]
|
#[experimental = "Deref is experimental."]
|
||||||
impl<T> Deref<T> for Rc<T> {
|
impl<T> Deref<T> for Rc<T> {
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
|
|||||||
Reference in New Issue
Block a user