[][src]Struct neon::types::BinaryData

#[repr(C)]
pub struct BinaryData<'a> { /* fields omitted */ }

A reference to the internal backing buffer data of a Buffer or ArrayBuffer object, which can be accessed via the Borrow and BorrowMut traits.

Methods

impl<'a> BinaryData<'a>
[src]

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;
});

Produces the length of the buffer, in bytes.

Trait Implementations

impl<'a> Clone for BinaryData<'a>
[src]

Performs copy-assignment from source. Read more

impl<'a> Copy for BinaryData<'a>
[src]

Auto Trait Implementations

impl<'a> !Send for BinaryData<'a>

impl<'a> !Sync for BinaryData<'a>

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

impl<T> From for T
[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom for T where
    T: From<U>, 
[src]

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]