diff options
Diffstat (limited to 'components/layout/flow_ref.rs')
-rw-r--r-- | components/layout/flow_ref.rs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/components/layout/flow_ref.rs b/components/layout/flow_ref.rs index 7ee600919b0..029f7fade89 100644 --- a/components/layout/flow_ref.rs +++ b/components/layout/flow_ref.rs @@ -10,6 +10,7 @@ use flow::Flow; use flow; use std::mem; +use std::ops::{Deref, DerefMut}; use std::ptr; use std::raw; use std::sync::atomic::Ordering; @@ -19,6 +20,9 @@ pub struct FlowRef { object: raw::TraitObject, } +unsafe impl Send for FlowRef {} +unsafe impl Sync for FlowRef {} + impl FlowRef { pub fn new(mut flow: Box<Flow>) -> FlowRef { unsafe { @@ -33,7 +37,8 @@ impl FlowRef { } } -impl<'a> Deref<Flow + 'a> for FlowRef { +impl<'a> Deref for FlowRef { + type Target = Flow + 'a; fn deref(&self) -> &(Flow + 'a) { unsafe { mem::transmute_copy::<raw::TraitObject, &(Flow + 'a)>(&self.object) @@ -41,7 +46,7 @@ impl<'a> Deref<Flow + 'a> for FlowRef { } } -impl<'a> DerefMut<Flow + 'a> for FlowRef { +impl<'a> DerefMut for FlowRef { fn deref_mut<'a>(&mut self) -> &mut (Flow + 'a) { unsafe { mem::transmute_copy::<raw::TraitObject, &mut (Flow + 'a)>(&self.object) |