embedded_touch/traits.rs
1use crate::Touch;
2
3/// Blocking interface for touch devices.
4pub trait TouchInputDevice {
5 /// Error type from the underlying interface
6 type Error;
7
8 /// Read current touch points, blocking until data is available
9 ///
10 /// Returns an iterator of *all* touch points currently detected.
11 /// Drivers must track touch IDs across calls to maintain correct phase information.
12 fn touches(&mut self) -> Result<impl IntoIterator<Item = &Touch>, Self::Error>;
13}
14
15/// Async interface for event-driven operation of touch devices
16pub trait AsyncTouchInputDevice {
17 /// Error type from the underlying interface
18 type Error;
19
20 /// Asynchronously wait until touch points are available
21 ///
22 /// Returns an iterator of *all* touch points currently detected.
23 /// Drivers must track touch IDs across calls to maintain correct phase information.
24 fn touches(
25 &mut self,
26 ) -> impl Future<Output = Result<impl IntoIterator<Item = &Touch>, Self::Error>>;
27}