Skip to content

Commit

Permalink
Implement BorrowFrom<Arc<T>> for T
Browse files Browse the repository at this point in the history
  • Loading branch information
csouth3 committed Dec 17, 2014
1 parent 42deaa5 commit 9caa66f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/liballoc/arc.rs
Expand Up @@ -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};
Expand Down Expand Up @@ -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]
Expand Down

0 comments on commit 9caa66f

Please sign in to comment.