diff options
| author | bors <bors@rust-lang.org> | 2013-10-24 17:36:07 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2013-10-24 17:36:07 -0700 |
| commit | b0c475229a286542b0a94bf33598cc53a525d8da (patch) | |
| tree | 3cf0a7fce75da4bf02612b3edbafd3e766929d89 | |
| parent | 3f5b2219cc893b30863f9136703166f306fcc684 (diff) | |
| parent | b13415cccceb80fff99d422b51a7026a019ce878 (diff) | |
| download | rust-b0c475229a286542b0a94bf33598cc53a525d8da.tar.gz rust-b0c475229a286542b0a94bf33598cc53a525d8da.zip | |
auto merge of #10055 : pcwalton/rust/arc-clone-inline, r=alexcrichton
r? @thestinger
| -rw-r--r-- | src/libextra/arc.rs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/libextra/arc.rs b/src/libextra/arc.rs index 1ce52d1d278..df67b1c9cc1 100644 --- a/src/libextra/arc.rs +++ b/src/libextra/arc.rs @@ -117,10 +117,12 @@ pub struct Arc<T> { priv x: UnsafeArc<T> } */ impl<T:Freeze+Send> Arc<T> { /// Create an atomically reference counted wrapper. + #[inline] pub fn new(data: T) -> Arc<T> { Arc { x: UnsafeArc::new(data) } } + #[inline] pub fn get<'a>(&'a self) -> &'a T { unsafe { &*self.x.get_immut() } } @@ -148,6 +150,7 @@ impl<T:Freeze + Send> Clone for Arc<T> { * object. However, one of the `arc` objects can be sent to another task, * allowing them to share the underlying data. */ + #[inline] fn clone(&self) -> Arc<T> { Arc { x: self.x.clone() } } @@ -167,6 +170,7 @@ pub struct MutexArc<T> { priv x: UnsafeArc<MutexArcInner<T>> } impl<T:Send> Clone for MutexArc<T> { /// Duplicate a mutex-protected Arc. See arc::clone for more details. + #[inline] fn clone(&self) -> MutexArc<T> { // NB: Cloning the underlying mutex is not necessary. Its reference // count would be exactly the same as the shared state's. @@ -349,6 +353,7 @@ pub struct RWArc<T> { impl<T:Freeze + Send> Clone for RWArc<T> { /// Duplicate a rwlock-protected Arc. See arc::clone for more details. + #[inline] fn clone(&self) -> RWArc<T> { RWArc { x: self.x.clone() } } |
