mirror of https://github.com/smol-rs/polling
feat: Make the constructors for Event const
This allows the Event struct to be used in constants. Signed-off-by: tison <wander4096@gmail.com>
This commit is contained in:
parent
c7cc91a1f1
commit
d8595b56a5
|
@ -337,7 +337,7 @@ pub struct EventExtra {
|
|||
impl EventExtra {
|
||||
/// Create an empty version of the data.
|
||||
#[inline]
|
||||
pub fn empty() -> EventExtra {
|
||||
pub const fn empty() -> EventExtra {
|
||||
EventExtra {
|
||||
flags: epoll::EventFlags::empty(),
|
||||
}
|
||||
|
|
|
@ -81,7 +81,7 @@ impl AfdPollMask {
|
|||
pub(crate) const CONNECT_FAIL: AfdPollMask = AfdPollMask(0x100);
|
||||
|
||||
/// Creates an empty mask.
|
||||
pub(crate) fn empty() -> AfdPollMask {
|
||||
pub(crate) const fn empty() -> AfdPollMask {
|
||||
AfdPollMask(0)
|
||||
}
|
||||
|
||||
|
|
|
@ -651,7 +651,7 @@ pub struct EventExtra {
|
|||
impl EventExtra {
|
||||
/// Create a new, empty version of this struct.
|
||||
#[inline]
|
||||
pub fn empty() -> EventExtra {
|
||||
pub const fn empty() -> EventExtra {
|
||||
EventExtra {
|
||||
flags: AfdPollMask::empty(),
|
||||
}
|
||||
|
|
|
@ -268,7 +268,7 @@ pub struct EventExtra;
|
|||
impl EventExtra {
|
||||
/// Create a new, empty version of this struct.
|
||||
#[inline]
|
||||
pub fn empty() -> EventExtra {
|
||||
pub const fn empty() -> EventExtra {
|
||||
EventExtra
|
||||
}
|
||||
|
||||
|
|
|
@ -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 {
|
||||
Event {
|
||||
key,
|
||||
readable: true,
|
||||
|
@ -198,7 +198,7 @@ impl Event {
|
|||
/// Only the readable event.
|
||||
///
|
||||
/// Equivalent to: `Event { key, readable: true, writable: false }`
|
||||
pub fn readable(key: usize) -> Event {
|
||||
pub const fn readable(key: usize) -> Event {
|
||||
Event {
|
||||
key,
|
||||
readable: true,
|
||||
|
@ -210,7 +210,7 @@ impl Event {
|
|||
/// Only the writable event.
|
||||
///
|
||||
/// Equivalent to: `Event { key, readable: false, writable: true }`
|
||||
pub fn writable(key: usize) -> Event {
|
||||
pub const fn writable(key: usize) -> Event {
|
||||
Event {
|
||||
key,
|
||||
readable: false,
|
||||
|
@ -222,7 +222,7 @@ impl Event {
|
|||
/// No events.
|
||||
///
|
||||
/// Equivalent to: `Event { key, readable: false, writable: false }`
|
||||
pub fn none(key: usize) -> Event {
|
||||
pub const fn none(key: usize) -> Event {
|
||||
Event {
|
||||
key,
|
||||
readable: false,
|
||||
|
|
|
@ -398,7 +398,7 @@ pub struct EventExtra {
|
|||
impl EventExtra {
|
||||
/// Creates an empty set of extra information.
|
||||
#[inline]
|
||||
pub fn empty() -> Self {
|
||||
pub const fn empty() -> Self {
|
||||
Self {
|
||||
flags: PollFlags::empty(),
|
||||
}
|
||||
|
|
|
@ -221,7 +221,7 @@ pub struct EventExtra {
|
|||
impl EventExtra {
|
||||
/// Create a new, empty version of this struct.
|
||||
#[inline]
|
||||
pub fn empty() -> EventExtra {
|
||||
pub const fn empty() -> EventExtra {
|
||||
EventExtra {
|
||||
flags: PollFlags::empty(),
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue