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

Usage of void and replacement with core::convert::Infallible #405

Closed
aleokdev opened this issue Mar 31, 2023 · 3 comments · Fixed by #482
Closed

Usage of void and replacement with core::convert::Infallible #405

aleokdev opened this issue Mar 31, 2023 · 3 comments · Fixed by #482

Comments

@aleokdev
Copy link

Hello, I've noticed a crate named void is used for infallible situations. However, since Rust 1.34.0, we have Infallible, which performs this task. Am I missing something, or could the void type the crate offers be replaced by this type?

@Rahix
Copy link
Owner

Rahix commented Mar 31, 2023

The missing pieces is the ResultVoidExt trait which gives us the handy void_unwrap() method.

core already has an equivalent in the making, called into_ok() but unfortunately this is still unstable.

So far, my take on the situation was to wait on stabilization of into_ok() and switch then. That is, unless the use of void proves to be problematic for downstream users in some place. If that is the case, please speak up :)

@Beanow
Copy link

Beanow commented Oct 19, 2023

See also:

At least in embedded-hal 0.2 there were some instances of void too. https://github.com/rust-embedded/embedded-hal/pull/150/files so regardless of what void_unwrap alternative to use, I think a migration to embedded-hal 1.0 should drop the void crate too.

@Rahix
Copy link
Owner

Rahix commented Oct 19, 2023

Nice, thanks for digging into this! I wasn't aware of the unwrap-infallible crate until now - I'd be totally on board with replacing void with unwrap-infallible here in avr-hal.

You are right, the best time is probably when adopting e-h 1.0 - until then I think the disruption is not worth it...

@Rahix Rahix linked a pull request Jan 11, 2024 that will close this issue
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

Successfully merging a pull request may close this issue.

3 participants