mirror of
https://github.com/feschber/lan-mouse.git
synced 2026-04-04 23:01:28 +03:00
Add a dummy backend
This commit is contained in:
committed by
Ferdinand Schober
parent
eca367cdb4
commit
f5a0ff4f3a
41
src/backend/producer/dummy.rs
Normal file
41
src/backend/producer/dummy.rs
Normal file
@@ -0,0 +1,41 @@
|
||||
use std::io;
|
||||
use std::pin::Pin;
|
||||
use std::task::{Poll, Context};
|
||||
|
||||
use futures_core::Stream;
|
||||
|
||||
use crate::event::Event;
|
||||
use crate::producer::EventProducer;
|
||||
|
||||
use crate::client::{ClientEvent, ClientHandle};
|
||||
|
||||
pub struct DummyProducer {}
|
||||
|
||||
impl DummyProducer {
|
||||
pub fn new() -> Self {
|
||||
Self {}
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for DummyProducer {
|
||||
fn default() -> Self {
|
||||
Self::new()
|
||||
}
|
||||
}
|
||||
|
||||
impl EventProducer for DummyProducer {
|
||||
fn notify(&mut self, _: ClientEvent) {}
|
||||
|
||||
fn release(&mut self) {}
|
||||
}
|
||||
|
||||
impl Stream for DummyProducer {
|
||||
type Item = io::Result<(ClientHandle, Event)>;
|
||||
|
||||
fn poll_next(
|
||||
self: Pin<&mut Self>,
|
||||
_cx: &mut Context<'_>,
|
||||
) -> Poll<Option<Self::Item>> {
|
||||
Poll::Pending
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
use anyhow::Result;
|
||||
use anyhow::{anyhow, Result};
|
||||
use std::{io, task::Poll};
|
||||
|
||||
use futures_core::Stream;
|
||||
@@ -9,7 +9,7 @@ pub struct LibeiProducer {}
|
||||
|
||||
impl LibeiProducer {
|
||||
pub fn new() -> Result<Self> {
|
||||
Ok(Self {})
|
||||
Err(anyhow!("not implemented"))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
use anyhow::{anyhow, Result};
|
||||
use std::io;
|
||||
use std::task::Poll;
|
||||
|
||||
@@ -11,14 +12,8 @@ use crate::client::{ClientEvent, ClientHandle};
|
||||
pub struct X11Producer {}
|
||||
|
||||
impl X11Producer {
|
||||
pub fn new() -> Self {
|
||||
Self {}
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for X11Producer {
|
||||
fn default() -> Self {
|
||||
Self::new()
|
||||
pub fn new() -> Result<Self> {
|
||||
return Err(anyhow!("not implemented"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user