Refactor and simplify input_method API

This commit is contained in:
Héctor Ramón Jiménez 2025-02-02 20:45:29 +01:00
parent d5ee9c2795
commit ae10adda74
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
19 changed files with 540 additions and 472 deletions

View file

@ -8,6 +8,15 @@ pub enum RedrawRequest {
/// Redraw at the given time.
At(Instant),
/// No redraw is needed.
Wait,
}
impl From<Instant> for RedrawRequest {
fn from(time: Instant) -> Self {
Self::At(time)
}
}
#[cfg(test)]
@ -34,5 +43,8 @@ mod tests {
assert!(RedrawRequest::At(now) <= RedrawRequest::At(now));
assert!(RedrawRequest::At(now) <= RedrawRequest::At(later));
assert!(RedrawRequest::At(later) >= RedrawRequest::At(now));
assert!(RedrawRequest::Wait > RedrawRequest::NextFrame);
assert!(RedrawRequest::Wait > RedrawRequest::At(later));
}
}