Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support conversion of &[T] and &str between languages #1853

Closed
w-utter opened this issue Apr 4, 2024 · 4 comments
Closed

Support conversion of &[T] and &str between languages #1853

w-utter opened this issue Apr 4, 2024 · 4 comments
Labels
enhancement New feature or request

Comments

@w-utter
Copy link

w-utter commented Apr 4, 2024

Maybe this isn't the way to pass references across the ffi boundary, but say we have a rust defined struct which has been crossed over to dart, say List<RustType>, if we wanted to modify that type by taking a &mut [RustType] in rust. In Flutter, the corresponding type in the function declaration would be RustType which isn't completely correct.

Similarily, on the other side, if we wanted to return a &str from rust into flutter, we would have to clone the string in order to send it across the ffi boundary, since the trait SSeEncode is not implemented for &str.

Having to send owned variants across FFI is a way to bypass this, but I think that being able to pass references would be a much better option (aside from issues that may arise from lifetimes).

@w-utter w-utter added the enhancement New feature or request label Apr 4, 2024
Copy link

welcome bot commented Apr 4, 2024

Hi! Thanks for opening your first issue here! 😄

@fzyzcjy
Copy link
Owner

fzyzcjy commented Apr 4, 2024

Hi, have you tried the opaque feature? That one seems to be related.

@fzyzcjy
Copy link
Owner

fzyzcjy commented May 22, 2024

Close since inactivity, but feel free to reopen!

@fzyzcjy fzyzcjy closed this as completed May 22, 2024
Copy link
Contributor

github-actions bot commented Jun 5, 2024

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 5, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants