-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Open
Labels
C - needs discussionDirection must be ironed outDirection must be ironed out
Milestone
Description
From #3056 (comment):
If we want to continue using the extension trait model for platform-specific features, I came up with the following idea that we could use for enums:
enum Event {
EventA,
EventB(String),
EventC {
data: u16,
},
Platform(PlatformEvent),
}
impl PlatformEventExtWayland for PlatformEvent {
fn event(&self) -> WaylandEvent {
self.0
}
}
// Not really needed, just a neat idea.
impl PlatformEventExtWindows for PlatformEvent {
fn event(&self) -> ! {
match self.0 { }
}
}Alternatively we can always mark the enum #[non_exhausive] and add cfg-gated variants.
For consistency with the current API I would like to go with the first solution. The first thing I would like to apply this to is to re-introduce the ControlFlow enum after #3056.
Metadata
Metadata
Assignees
Labels
C - needs discussionDirection must be ironed outDirection must be ironed out