Files
lan-mouse/input-capture/src/dummy.rs
2024-08-09 15:01:39 +02:00

49 lines
1.0 KiB
Rust

use std::pin::Pin;
use std::task::{Context, Poll};
use async_trait::async_trait;
use futures_core::Stream;
use super::{Capture, CaptureError, CaptureEvent, CaptureHandle, Position};
pub struct DummyInputCapture {}
impl DummyInputCapture {
pub fn new() -> Self {
Self {}
}
}
impl Default for DummyInputCapture {
fn default() -> Self {
Self::new()
}
}
#[async_trait]
impl Capture for DummyInputCapture {
async fn create(&mut self, _handle: CaptureHandle, _pos: Position) -> Result<(), CaptureError> {
Ok(())
}
async fn destroy(&mut self, _handle: CaptureHandle) -> Result<(), CaptureError> {
Ok(())
}
async fn release(&mut self) -> Result<(), CaptureError> {
Ok(())
}
async fn terminate(&mut self) -> Result<(), CaptureError> {
Ok(())
}
}
impl Stream for DummyInputCapture {
type Item = Result<(CaptureHandle, CaptureEvent), CaptureError>;
fn poll_next(self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {
Poll::Pending
}
}