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

Change return type of listen() #13

Closed
maxbla opened this issue Mar 22, 2020 · 1 comment
Closed

Change return type of listen() #13

maxbla opened this issue Mar 22, 2020 · 1 comment

Comments

@maxbla
Copy link
Contributor

maxbla commented Mar 22, 2020

I suggest changing the return type of listen() from (), the unit type to Result<!, ListenError>. This would better document what listen is supposed to do (i.e. never return, unless there was a error setting it up), and it would be more idiomatic Rust. Safe functions in Rust usually don't panic, with some exceptions (like an out of bounds index on an array). This would also require you to create some error type representing possible errors in executing listen.

It would be a breaking change, although pretty easy for users to fix - just change listen() to listen().unwrap() to get the old behavior.

@Narsil
Copy link
Owner

Narsil commented Mar 24, 2020

Fixed in master.

I decided against "!" because it's an experimental feature.

@Narsil Narsil closed this as completed Mar 24, 2020
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

2 participants