Implemented BorrowFrom<Rc<T>> for T.
This commit is contained in:
parent
2e996ffb46
commit
ad7dacd9eb
1 changed files with 7 additions and 0 deletions
|
@ -141,6 +141,7 @@
|
|||
|
||||
#![stable]
|
||||
|
||||
use core::borrow::BorrowFrom;
|
||||
use core::cell::Cell;
|
||||
use core::clone::Clone;
|
||||
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."]
|
||||
impl<T> Deref<T> for Rc<T> {
|
||||
#[inline(always)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue