Implement BorrowFrom<Arc<T>> for T

This commit is contained in:
Chase Southwood 2014-12-16 22:12:40 -06:00
parent 42deaa5e42
commit 9caa66f9c8

View File

@ -14,6 +14,7 @@
//! between tasks.
use core::atomic;
use core::borrow::BorrowFrom;
use core::clone::Clone;
use core::fmt::{mod, Show};
use core::cmp::{Eq, Ord, PartialEq, PartialOrd, Ordering};
@ -155,6 +156,12 @@ impl<T> Clone for Arc<T> {
}
}
impl<T> BorrowFrom<Arc<T>> for T {
fn borrow_from(owned: &Arc<T>) -> &T {
&**owned
}
}
#[experimental = "Deref is experimental."]
impl<T> Deref<T> for Arc<T> {
#[inline]