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 Nov 15, 2023
1 parent a8f7fd9 commit b652ff3
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 @@ -335,7 +335,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 @@ -619,10 +629,8 @@ impl<const C: usize, const R: usize, const L: usize, T: 'static, K: 'static + Co
}
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 b652ff3

Please sign in to comment.