Add a dummy backend

This commit is contained in:
Ferdinand Schober
2023-12-17 19:06:27 +01:00
committed by Ferdinand Schober
parent eca367cdb4
commit f5a0ff4f3a
11 changed files with 163 additions and 183 deletions

View 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
}
}

View File

@@ -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"))
}
}

View File

@@ -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"));
}
}