Skip to content

Example code for reading an ArrayBufferView? #18

Open
@DiThi

Description

@DiThi

Hi, despite the lack of documentation, examples or tests, I've figured out how to read most values I needed from function arguments. But I haven't been able to read an ArrayBuffer or ArrayBufferView.

Here's one of my attempts:

use v8::*;
fn testf(info: value::FunctionCallbackInfo) -> Result<Value, Value> {
    let arr = info.args[0].into_array_buffer_view().unwrap();
    println!("{:?}", arr);
    Ok(Value::from(value::undefined(&info.isolate)))
}

for which I get

29 |     let arr = info.args[0].into_array_buffer().unwrap();
   |               ^^^^^^^^^^^^ cannot move out of indexed content

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions