Struct js::typedarray::TypedArray
[−]
[src]
pub struct TypedArray<'a, T: 'a + TypedArrayElement> { /* fields omitted */ }
A rooted typed array.
Methods
impl<'a, T: TypedArrayElement> TypedArray<'a, T>
[src]
pub fn from(
cx: *mut JSContext,
root: &'a mut Rooted<*mut JSObject>,
object: *mut JSObject
) -> Result<Self, ()>
[src]
cx: *mut JSContext,
root: &'a mut Rooted<*mut JSObject>,
object: *mut JSObject
) -> Result<Self, ()>
Create a typed array representation that wraps an existing JS reflector. This operation will fail if attempted on a JS object that does not match the expected typed array details.
pub unsafe fn as_slice(&mut self) -> &[T::Element]
[src]
Unsafety
The returned slice can be invalidated if the underlying typed array is neutered.
pub unsafe fn as_mut_slice(&mut self) -> &mut [T::Element]
[src]
Unsafety
The returned slice can be invalidated if the underlying typed array is neutered.
The underlying JSObject
can be aliased, which can lead to
Undefined Behavior due to mutable aliasing.
impl<'a, T: TypedArrayElementCreator + TypedArrayElement> TypedArray<'a, T>
[src]
pub unsafe fn create(
cx: *mut JSContext,
with: CreateWith<T::Element>,
result: MutableHandleObject
) -> Result<(), ()>
[src]
cx: *mut JSContext,
with: CreateWith<T::Element>,
result: MutableHandleObject
) -> Result<(), ()>
Create a new JS typed array, optionally providing initial data that will be copied into the newly-allocated buffer. Returns the new JS reflector.
pub unsafe fn update(&mut self, data: &[T::Element])
[src]
Update an existed JS typed array