thedes_tui_core/screen/device/
null.rs

1use thedes_async_util::dyn_async_trait;
2
3use crate::geometry::CoordPair;
4
5use super::{Command, Error, ScreenDevice};
6
7pub fn open() -> Box<dyn ScreenDevice> {
8    Box::new(NullScreenDevice)
9}
10
11#[derive(Debug, Clone, Copy)]
12struct NullScreenDevice;
13
14#[dyn_async_trait]
15impl ScreenDevice for NullScreenDevice {
16    fn send_raw(
17        &mut self,
18        commands: &mut (dyn Iterator<Item = Command> + Send + Sync),
19    ) -> Result<(), Error> {
20        commands.for_each(drop);
21        Ok(())
22    }
23
24    async fn flush(&mut self) -> Result<(), Error> {
25        Ok(())
26    }
27
28    fn blocking_get_size(&mut self) -> Result<CoordPair, Error> {
29        Ok(CoordPair { y: 1000, x: 1000 })
30    }
31}