mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
Introduce TaskOnce
Having both TaskBox and TaskOnce allows us to remove the superfluous inner boxing from CancellableTask<T>.
This commit is contained in:
parent
52527d6f9d
commit
6c9fb5ae7a
26 changed files with 144 additions and 124 deletions
|
@ -40,7 +40,7 @@ use std::marker::PhantomData;
|
|||
use std::os;
|
||||
use std::rc::Rc;
|
||||
use std::sync::{Arc, Weak};
|
||||
use task::TaskBox;
|
||||
use task::TaskOnce;
|
||||
|
||||
|
||||
#[allow(missing_docs)] // FIXME
|
||||
|
@ -122,7 +122,7 @@ impl TrustedPromise {
|
|||
|
||||
/// A task which will reject the promise.
|
||||
#[allow(unrooted_must_root)]
|
||||
pub fn reject_task(self, error: Error) -> impl TaskBox {
|
||||
pub fn reject_task(self, error: Error) -> impl TaskOnce {
|
||||
let this = self;
|
||||
task!(reject_promise: move || {
|
||||
debug!("Rejecting promise.");
|
||||
|
@ -135,7 +135,7 @@ impl TrustedPromise {
|
|||
|
||||
/// A task which will resolve the promise.
|
||||
#[allow(unrooted_must_root)]
|
||||
pub fn resolve_task<T>(self, value: T) -> impl TaskBox
|
||||
pub fn resolve_task<T>(self, value: T) -> impl TaskOnce
|
||||
where
|
||||
T: ToJSValConvertible + Send,
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue