Skip to content

Conversation

patrickariel
Copy link

This PR adds a new error type representing an under-filled state for ArrayVec::into_inner. Previously, it would return self which is rather unconventional and prevents ergonomic error propagation (e.g. with ?).

@tbu-
Copy link
Collaborator

tbu- commented Dec 20, 2024

This change is a breaking change and would need a new major version.

After the change, one could no longer recover the original array.

Workaround for your use case: You can use .map_err(|_| YourError::Underfilled)? to use it with the question mark operator.

@patrickariel
Copy link
Author

Thanks for the feedback, I changed it so that the error stores the original vec, allowing the user to recover it using take_vec.

Workaround for your use case: You can use .map_err(|_| YourError::Underfilled)? to use it with the question mark operator.

This is what I'm currently doing, but it'd more convenient to have a canonical error type 🙂

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 this pull request may close these issues.

2 participants