diff options
author | Anthony Ramine <n.oxyde@gmail.com> | 2017-09-20 10:37:09 +0200 |
---|---|---|
committer | Anthony Ramine <n.oxyde@gmail.com> | 2017-09-20 10:37:09 +0200 |
commit | 6c9fb5ae7a4eb6cff38de3bb6446af304a32bc8a (patch) | |
tree | 63a8bd729171e5886340fe89774f2287bd11cb5b /components/script/dom/bluetooth.rs | |
parent | 52527d6f9dfaae13458059243d975f5336bdead4 (diff) | |
download | servo-6c9fb5ae7a4eb6cff38de3bb6446af304a32bc8a.tar.gz servo-6c9fb5ae7a4eb6cff38de3bb6446af304a32bc8a.zip |
Introduce TaskOnce
Having both TaskBox and TaskOnce allows us to remove the superfluous inner boxing
from CancellableTask<T>.
Diffstat (limited to 'components/script/dom/bluetooth.rs')
-rw-r--r-- | components/script/dom/bluetooth.rs | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/components/script/dom/bluetooth.rs b/components/script/dom/bluetooth.rs index 27a588a1a63..526ebe576fc 100644 --- a/components/script/dom/bluetooth.rs +++ b/components/script/dom/bluetooth.rs @@ -40,7 +40,7 @@ use std::collections::HashMap; use std::rc::Rc; use std::str::FromStr; use std::sync::{Arc, Mutex}; -use task::TaskBox; +use task::TaskOnce; const KEY_CONVERSION_ERROR: &'static str = "This `manufacturerData` key can not be parsed as unsigned short:"; const FILTER_EMPTY_ERROR: &'static str = "'filters' member, if present, must be nonempty to find any devices."; @@ -229,18 +229,17 @@ pub fn response_async<T: AsyncBluetoothListener + DomObject + 'static>( action: BluetoothResponseResult, } - impl<T> TaskBox for ListenerTask<T> + impl<T> TaskOnce for ListenerTask<T> where T: AsyncBluetoothListener + DomObject, { - fn run_box(self: Box<Self>) { - let this = *self; - let mut context = this.context.lock().unwrap(); - context.response(this.action); + fn run_once(self) { + let mut context = self.context.lock().unwrap(); + context.response(self.action); } } - let task = box ListenerTask { + let task = ListenerTask { context: context.clone(), action: message.to().unwrap(), }; |