-
Notifications
You must be signed in to change notification settings - Fork 67
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
feat: enable construct event constantly #140
Conversation
Perhaps I can use a Keep this PR open for ideas on whether we can make the event constructors themselves const. |
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.
I think this would be a good addition to this crate.
EventExtra { | ||
flags: AfdPollMask::empty(), | ||
} |
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.
Fix the compile error by also making AfdPollMask::empty()
constant.
@@ -186,7 +186,7 @@ impl Event { | |||
/// All kinds of events (readable and writable). | |||
/// | |||
/// Equivalent to: `Event { key, readable: true, writable: true }` | |||
pub fn all(key: usize) -> Event { | |||
pub const fn all(key: usize) -> Event { |
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.
You forgot to make the poll.rs
version of EventEmpty
const
.
Signed-off-by: tison <[email protected]>
Updated at here. Let's see if all the empty branches can be |
All tests passed. PTAL @notgull |
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.
Looks good to me!
Maybe #133 can prevent this from being possible; since it includes sys details for
Event
.These
sys
things are one of the main complain onmio
that I want to get rid of.Compare with
mio
, it can obtain aconst TOKEN: Token = Token(0)
, while inpolling
we cannot obtain a const interestEvent
likeconst INTEREST: Event = Event::readable(1)
. I don't want to know about thesys
things.cc @notgull