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

Good Idea: safe way to transmute Vec<Option<&Foo>> to Vec<&Foo> #267

Open
Lokathor opened this issue Aug 23, 2024 · 0 comments
Open

Good Idea: safe way to transmute Vec<Option<&Foo>> to Vec<&Foo> #267

Lokathor opened this issue Aug 23, 2024 · 0 comments

Comments

@Lokathor
Copy link
Owner

Lokathor commented Aug 23, 2024

https://www.reddit.com/r/rust/comments/1ez6f2c/any_safe_way_to_transmute_vecoptionfoo_to_vecfoo/


So yeah, what we want is to be able to convert from Option<&i32> to &i32, particularly within a vec/slice/container.

There's lots of types with guaranteed option representation, so we probably want to use some sort of trait.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant