Implement Debug for JsFuture

This commit is contained in:
Laurențiu Nicola
2019-04-20 09:29:03 +03:00
parent 7decb133f0
commit 04a78badc5
2 changed files with 14 additions and 0 deletions

View File

@ -104,6 +104,7 @@
#![deny(missing_docs)]
use std::cell::{Cell, RefCell};
use std::fmt;
use std::rc::Rc;
use std::sync::Arc;
@ -128,6 +129,12 @@ pub struct JsFuture {
callbacks: Option<(Closure<FnMut(JsValue)>, Closure<FnMut(JsValue)>)>,
}
impl fmt::Debug for JsFuture {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "JsFuture {{ ... }}")
}
}
impl From<Promise> for JsFuture {
fn from(js: Promise) -> JsFuture {
// Use the `then` method to schedule two callbacks, one for the