Skip to content

Support for u8 slices #5

Closed
Closed
@nickbabcock

Description

@nickbabcock
wasm_bindgen! {
    pub fn parse_data(data: &[u8]) -> i32 {
        data.len() as i32
    }
}

Returns

unsupported reference type

I'm hoping that you'd be open to more borrowed types (specifically &[u8]) in addition to BorrowedStr. This could be part of a larger issue to support Vec and other slices, but I figure &[u8] might be easiest and would be implemented very closely to BorrowedStr.

Use case:

After I use a FileReader to read a binary file into an ArrayBuffer and create WebAssembly.Memory (I believe that flow is correct), I want to send the data to rust for parsing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions