Skip to content

unsupported element type of Vec #1222

@OlivierLDff

Description

@OlivierLDff

Context

I'm beginner with the library, so I'm relying a lot on the book. I read the book about the opaque rust type that I should use a Box to expose that to c++.

What I wanted to do

  • I created a first function new_my_type() -> Box<MyType>.
  • Then I wanted to add a fetch_some_types -> Vec<Box<MyType>> and I got unsupported element type of Vec.

How i fixed it

  • of course fetch_some_types -> Vec<MyType> was enough for it to work. But I couldn't find example in the book.

What could be improved

It would be nice to have some more documentation in the book about Vec, that type should be wrapped in struct for it to work. I've found the solution with #671.

We could add in the book categories:

  • Vec of opaque rust type (ie you don't need to put a Box
  • Vec of an unsupported element: wrap it in a struct.

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