mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-30 03:57:37 +00:00
libextra: Make arc::get and arc::new inline too.
Should be a 2x improvement in a Servo test case.
This commit is contained in:
parent
76287ccbb0
commit
b13415cccc
@ -117,10 +117,12 @@ pub struct Arc<T> { priv x: UnsafeArc<T> }
|
|||||||
*/
|
*/
|
||||||
impl<T:Freeze+Send> Arc<T> {
|
impl<T:Freeze+Send> Arc<T> {
|
||||||
/// Create an atomically reference counted wrapper.
|
/// Create an atomically reference counted wrapper.
|
||||||
|
#[inline]
|
||||||
pub fn new(data: T) -> Arc<T> {
|
pub fn new(data: T) -> Arc<T> {
|
||||||
Arc { x: UnsafeArc::new(data) }
|
Arc { x: UnsafeArc::new(data) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
pub fn get<'a>(&'a self) -> &'a T {
|
pub fn get<'a>(&'a self) -> &'a T {
|
||||||
unsafe { &*self.x.get_immut() }
|
unsafe { &*self.x.get_immut() }
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user