-
Notifications
You must be signed in to change notification settings - Fork 45
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
simple mio example #49
base: master
Are you sure you want to change the base?
Conversation
Thanks for the example @lthiery; can you run |
examples/mio.rs
Outdated
|
||
// TODO: for some reason, there is always a dummy event initially | ||
// Workaround: waste the first event | ||
poll.poll(&mut events, None).unwrap(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is expected behavior from the linux kernel.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting! I had no idea. Is there a TLDR of why it's expected so I can add it to the comments?
examples/mio.rs
Outdated
fn main(){ | ||
|
||
let pin = Pin::new(49); | ||
pin.set_direction(Direction::In).unwrap(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than doing unwrap
everywhere it might be best to create a helper that returns the appropriate result.
bors try |
@mathk I haven't made my rounds on this repo to enable bors yet but may be doing some of that tomorrow. |
This probably needs a rebase to have a better chance with CI. |
I guess you need to feature gate your test: |
This would need to be adapted to the updated |
tryBuild failed: |
I was trying to use this library without all the tokio stuff and wished there was a mio example. I shared back this example, although it's not fancy and doesn't take args.
Plus, there is something funny happening where the first event is non-sense...