pub fn as_slice<T: BinaryViewType>(self) -> &'a [T] {
        if self.size == 0 {
            &[]
        } else {
            let base = self.base.cast();
            let len = self.size / mem::size_of::<T>();
            unsafe { slice::from_raw_parts(base, len) }
        }
    }
/// Produces an immutable slice as a view into the contents of this buffer.
///
/// # Example:
///
/// ```no_run
/// # use neon::prelude::*;
/// # fn get_x_and_y(mut cx: FunctionContext) -> JsResult<JsUndefined> {
/// let b: Handle<JsArrayBuffer> = cx.argument(0)?;
/// let (x, y) = cx.borrow(&b, |data| {
///     let slice = data.as_slice::<i32>();
///     (slice[0], slice[1])
/// });
/// # println!("({}, {})", x, y);
/// # Ok(cx.undefined())
/// # }
/// ```
Produces an immutable slice as a view into the contents of this buffer.
Produces an immutable slice as a view into the contents of this buffer .
pub fn as_slice<T: BinaryViewType>(self) -> &'a [T] {
        if self.size == 0 {
            &[]
        } else {
            let base = self.base.cast();
            let len = self.size / mem::size_of::<T>();
            unsafe { slice::from_raw_parts(base, len) }
        }
    }
pub fn as_slice < T : BinaryViewType > ( self ) -> & ' a [ T ] { if self . size == 0 { & [ ] } else { let base = self . base . cast ( ) ; let len = self . size / mem :: size_of :: < T > ( ) ; unsafe { slice :: from_raw_parts ( base , len ) } } }
Produces an immutable slice as a view into the contents of this buffer.
Produces an immutable slice as a view into the contents of this buffer .
self
example:
None
use neon::prelude::*;
None
fn get_x_and_y(mut cx: functioncontext) -> jsresult<jsundefined> {
None
println!("({}, {})", x, y);
None
ok(cx.undefined())
None
}
None