Make Actuator trait non-async

This commit is contained in:
Gregor Reitzenstein 2020-09-17 16:05:46 +02:00
parent 173ef6d055
commit e0c1ce868d
2 changed files with 4 additions and 6 deletions

View File

@ -49,9 +49,8 @@ impl Shelly {
}
#[async_trait]
impl Actuator for Shelly {
async fn subscribe(&mut self, signal: StatusSignal) {
fn subscribe(&mut self, signal: StatusSignal) {
self.signal.replace(signal);
if let Some(waker) = self.waker.take() {
waker.wake();

View File

@ -38,9 +38,8 @@ impl Actuators {
pub type StatusSignal = Pin<Box<dyn Signal<Item = Status> + Send + Sync>>;
#[async_trait]
pub trait Actuator: Stream<Item = future::BoxFuture<'static, ()>> {
async fn subscribe(&mut self, signal: StatusSignal);
fn subscribe(&mut self, signal: StatusSignal);
}
// This is merely a proof that Actuator *can* be implemented on a finite, known type. Yay for type
@ -49,9 +48,9 @@ struct Dummy {
log: Logger,
signal: Option<StatusSignal>
}
#[async_trait]
impl Actuator for Dummy {
async fn subscribe(&mut self, signal: StatusSignal) {
fn subscribe(&mut self, signal: StatusSignal) {
self.signal.replace(signal);
}
}