Skip to content

Commit b70355b

Browse files
committed
layout: impl Default for SequenceState
1 parent 2b4b122 commit b70355b

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/layout.rs

+11-3
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,17 @@ struct SequenceState<K: 'static> {
335335
delay: u32,
336336
/// Keycode of a key that should be released at the next tick
337337
tapped: Option<K>,
338+
}
338339

340+
impl<K: Copy> Default for SequenceState<K> {
341+
fn default() -> Self {
342+
Self {
343+
cur_event: None,
344+
remaining_events: &[],
345+
delay: 0,
346+
tapped: None,
347+
}
348+
}
339349
}
340350

341351
/// An event, waiting in a stack to be processed.
@@ -619,10 +629,8 @@ impl<const C: usize, const R: usize, const L: usize, T: 'static, K: 'static + Co
619629
}
620630
Sequence(events) => {
621631
self.active_sequences.push_back(SequenceState {
622-
cur_event: None,
623-
delay: 0,
624-
tapped: None,
625632
remaining_events: events,
633+
..Default::default()
626634
});
627635
}
628636
&Layer(value) => {

0 commit comments

Comments
 (0)