Skip to content

Commit

Permalink
layout: impl Default for SequenceState
Browse files Browse the repository at this point in the history
  • Loading branch information
borisfaure committed Jul 27, 2023
1 parent 5164374 commit 5566dcf
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,17 @@ struct SequenceState<K: 'static> {
delay: u32,
/// Keycode of a key that should be released at the next tick
tapped: Option<K>,
}

impl<K: Copy> Default for SequenceState<K> {
fn default() -> Self {
Self {
cur_event: None,
remaining_events: &[],
delay: 0,
tapped: None,
}
}
}

/// An event, waiting in a stack to be processed.
Expand Down Expand Up @@ -629,10 +639,8 @@ impl<
}
Sequence(events) => {
self.active_sequences.push_back(SequenceState {
cur_event: None,
delay: 0,
tapped: None,
remaining_events: events,
..Default::default()
});
}
&Layer(value) => {
Expand Down

0 comments on commit 5566dcf

Please sign in to comment.