mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Implement trait dom::bindings::conversions::JSValConvertible for f64.
This commit is contained in:
parent
6b764440d7
commit
9b284431ef
1 changed files with 15 additions and 1 deletions
|
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue