mirror of
https://github.com/servo/servo.git
synced 2025-10-14 15:30:27 +01:00
Add some more Blob methods/types
This commit is contained in:
parent
e98ddef9bb
commit
586dd6aed6
4 changed files with 63 additions and 17 deletions
|
@ -11,6 +11,23 @@ pub trait JSValConvertible {
|
|||
fn from_jsval(val: JSVal) -> Option<Self>;
|
||||
}
|
||||
|
||||
|
||||
impl JSValConvertible for i64 {
|
||||
#[fixed_stack_segment]
|
||||
fn to_jsval(&self) -> JSVal {
|
||||
unsafe {
|
||||
RUST_DOUBLE_TO_JSVAL(*self as f64)
|
||||
}
|
||||
}
|
||||
|
||||
#[fixed_stack_segment]
|
||||
fn from_jsval(val: JSVal) -> Option<i64> {
|
||||
unsafe {
|
||||
Some(RUST_JSVAL_TO_DOUBLE(val) as i64)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl JSValConvertible for u32 {
|
||||
#[fixed_stack_segment]
|
||||
fn to_jsval(&self) -> JSVal {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue