Struct neon::types::BinaryData [−][src]
#[repr(C)]pub struct BinaryData<'a> { /* fields omitted */ }
Expand description
A reference to the internal backing buffer data of a Buffer
or ArrayBuffer
object, which can be accessed via the Borrow
and BorrowMut
traits.
Implementations
Produces an immutable slice as a view into the contents of this buffer.
Example:
let b: Handle<JsArrayBuffer> = cx.argument(0)?;
let (x, y) = cx.borrow(&b, |data| {
let slice = data.as_slice::<i32>();
(slice[0], slice[1])
});
Produces a mutable slice as a view into the contents of this buffer.
Example:
let mut b: Handle<JsArrayBuffer> = cx.argument(0)?;
cx.borrow_mut(&mut b, |data| {
let slice = data.as_mut_slice::<f64>();
slice[0] /= 2.0;
slice[1] *= 2.0;
});
Trait Implementations
Auto Trait Implementations
impl<'a> RefUnwindSafe for BinaryData<'a>
impl<'a> !Send for BinaryData<'a>
impl<'a> !Sync for BinaryData<'a>
impl<'a> Unpin for BinaryData<'a>
impl<'a> UnwindSafe for BinaryData<'a>
Blanket Implementations
Mutably borrows from an owned value. Read more