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

Correct eb3b96b with a useful function signature for try_wait #413

Merged
merged 1 commit into from
Nov 24, 2022

Conversation

nospam2678
Copy link

@nospam2678 nospam2678 commented Nov 17, 2022

This is embarrassing. It appears my quality assurance for #412, while existent, was way flawed and insufficient.

Having a try_ method take ownership over self makes it impossible call it more than once. Clearly a mutable reference was what was indented and required to actually make the method meaningful.

It would be a good idea to either merge this PR, or revert the previous one, prior to making the next release.

@jonas-schievink
Copy link
Contributor

This change would be unsound (due to the unreachable_unchecked; but the only alternative is a panic or a signature change in the other methods, which is also not great) if the user started another transfer while the old one is still around.

I think we might want to remove try_wait in favor of having the user check is_done - if is_done returns true, the user knows that the next call to wait won't block.

Remove try_wait, but keep is_done. The function signature for try_wait
was buggily useless for all practical purposes.
@nospam2678
Copy link
Author

Indeed. Makes sense! Branch has been updated to remove try_wait and only leave is_done.

Maybe the corresponding is_done method should be added to also to TransferFullDuplex? I lack a hardware setup to do any I²S in the other direction, so that would be completely written blindly if I did it.

@jonas-schievink
Copy link
Contributor

bors r+

@bors
Copy link
Contributor

bors bot commented Nov 24, 2022

Build succeeded:

@bors bors bot merged commit 939c017 into nrf-rs:master Nov 24, 2022
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