Skip to content

Commit

Permalink
Implement trait dom::bindings::conversions::JSValConvertible for f64.
Browse files Browse the repository at this point in the history
  • Loading branch information
Tetsuharu OHZEKI committed Aug 23, 2013
1 parent 6b76444 commit 9b28443
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/components/script/dom/bindings/conversions.rs
Expand Up @@ -85,4 +85,18 @@ impl JSValConvertible for f32 {
Some(RUST_JSVAL_TO_DOUBLE(val) as f32)
}
}
}
}

impl JSValConvertible for f64 {
fn to_jsval(&self) -> JSVal {
unsafe {
RUST_DOUBLE_TO_JSVAL(*self as f64)
}
}

fn from_jsval(val: JSVal) -> Option<f64> {
unsafe {
Some(RUST_JSVAL_TO_DOUBLE(val) as f64)
}
}
}

0 comments on commit 9b28443

Please sign in to comment.