Auto merge of #15515 - nox:rustc-serialize, r=jdm

Remove rustc-serialize from range

<!-- Reviewable:start -->
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/15515)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-02-12 04:55:40 -08:00 committed by GitHub
commit 89dcbec0ba
4 changed files with 8 additions and 31 deletions

1
Cargo.lock generated
View file

@ -2147,7 +2147,6 @@ dependencies = [
"heapsize 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_derive 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
"num-traits 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.8.20 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 0.8.23 (registry+https://github.com/rust-lang/crates.io-index)",
]

View file

@ -14,6 +14,5 @@ path = "lib.rs"
heapsize = "0.3.0"
heapsize_derive = "0.1"
num-traits = "0.1.32"
rustc-serialize = "0.3"
serde = "0.8"
serde_derive = "0.8"

View file

@ -9,7 +9,6 @@
extern crate heapsize;
#[macro_use] extern crate heapsize_derive;
extern crate num_traits;
extern crate rustc_serialize;
#[macro_use]
extern crate serde_derive;
@ -145,7 +144,7 @@ macro_rules! int_range_index {
}
/// A range of indices
#[derive(Clone, Copy, Deserialize, HeapSizeOf, RustcEncodable, Serialize)]
#[derive(Clone, Copy, Deserialize, HeapSizeOf, Serialize)]
pub struct Range<I> {
begin: I,
length: I,

View file

@ -46,21 +46,19 @@ use js::error::throw_type_error;
use js::glue::{GetProxyPrivate, IsWrapper};
use js::glue::{RUST_JSID_IS_INT, RUST_JSID_TO_INT};
use js::glue::{RUST_JSID_IS_STRING, RUST_JSID_TO_STRING, UnwrapObject};
use js::jsapi::{HandleId, HandleObject, HandleValue, JSContext};
use js::jsapi::{JSObject, JSString};
use js::jsapi::{JS_GetLatin1StringCharsAndLength, JS_GetObjectAsArrayBuffer, JS_GetObjectAsArrayBufferView};
use js::jsapi::{JS_GetReservedSlot, JS_GetTwoByteStringCharsAndLength};
use js::jsapi::{JS_IsArrayObject, JS_NewStringCopyN, JS_StringHasLatin1Chars};
use js::jsapi::{JS_NewFloat32Array, JS_NewFloat64Array};
use js::jsapi::{JS_NewInt8Array, JS_NewInt16Array, JS_NewInt32Array};
use js::jsapi::{HandleId, HandleObject, HandleValue, JSContext, JSObject, JSString};
use js::jsapi::{JS_GetLatin1StringCharsAndLength, JS_GetReservedSlot};
use js::jsapi::{JS_GetTwoByteStringCharsAndLength, JS_IsArrayObject};
use js::jsapi::{JS_NewFloat32Array, JS_NewFloat64Array, JS_NewInt8Array};
use js::jsapi::{JS_NewInt16Array, JS_NewInt32Array, JS_NewStringCopyN};
use js::jsapi::{JS_NewUint8Array, JS_NewUint16Array, JS_NewUint32Array};
use js::jsapi::{MutableHandleValue, Type};
use js::jsapi::{JS_StringHasLatin1Chars, MutableHandleValue, Type};
use js::jsval::{ObjectValue, StringValue};
use js::rust::{ToString, get_object_class, is_dom_class, is_dom_object, maybe_wrap_value};
use libc;
use num_traits::Float;
use servo_config::opts;
use std::{char, mem, ptr, slice};
use std::{char, ptr, slice};
/// A trait to check whether a given `JSObject` implements an IDL interface.
pub trait IDLInterface {
@ -554,24 +552,6 @@ unsafe impl ArrayBufferViewContents for f64 {
}
}
/// Returns a mutable slice of the Array Buffer View data, viewed as T, without
/// checking the real type of it.
pub unsafe fn array_buffer_view_data<'a, T>(abv: *mut JSObject) -> Option<&'a mut [T]>
where T: ArrayBufferViewContents
{
assert!(!abv.is_null());
let mut byte_length = 0;
let mut ptr = ptr::null_mut();
let mut is_shared = false;
let ret = JS_GetObjectAsArrayBufferView(abv, &mut byte_length, &mut is_shared, &mut ptr);
assert!(!is_shared);
if ret.is_null() {
return None;
}
Some(slice::from_raw_parts_mut(ptr as *mut T, byte_length as usize / mem::size_of::<T>()))
}
/// Returns whether `value` is an array-like object.
/// Note: Currently only Arrays are supported.
/// TODO: Expand this to support sequences and other array-like objects