servo / rust-mozjs

DEPRECATED - moved to servo/mozjs instead.
Mozilla Public License 2.0
293 stars 122 forks source link

Add a method to ArrayBufferView that invokes JS_GetArrayBufferViewType #331

Closed jdm closed 7 years ago

jdm commented 7 years ago

There's a JS_GetArrayBufferViewType method that returns a enum indicating the concrete type of a JS typed array. We should add a convenience method to the high-level ArrayBufferView type that invokes it on the contained pointer and returns the result.

Code: typedarray.rs Test: add a test to tests/typedarray.rs and run via cargo test

jdm commented 7 years ago

@bd339 Would you like to work on this? We can use it to replace some places in Servo that invoke this code directly.

bd339 commented 7 years ago

Yeah I can take it on. Thanks for taking the time to find it.

jdm commented 7 years ago

@bd339 Have you made any progress on this?

bd339 commented 7 years ago

I have looked into it, but I ran into a problem with building this crate. How am I supposed to build the rust-mozjs crate? I tried a simple cargo build after cloning, but I got this error message:

unable to get packages from source

Caused by:
  failed to parse manifest at `/home/bd339/.cargo/registry/src/github.com-88ac128001ac3a9a/heapsize-0.3.8/Cargo.toml`

Caused by:
  could not parse input as TOML
/home/bd339/.cargo/registry/src/github.com-88ac128001ac3a9a/heapsize-0.3.8/Cargo.toml:10:9 expected a key but found an empty string
/home/bd339/.cargo/registry/src/github.com-88ac128001ac3a9a/heapsize-0.3.8/Cargo.toml:10:9-10:10 expected `.`, but found `'`
emilio commented 7 years ago

It seems you may be using an old rust version? Which version are you using?

bd339 commented 7 years ago

Not at the pc in question right now, but I think it is cargo version 0.8.0.

bd339 commented 7 years ago

Yeah you were right @emilio, I got it to build after updating rust and configuring it to use the nightly toolchain. Thanks.