blob: d6d212c639a23b6962d291f577468c8be0af336d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
pub mod png;
pub mod wait_for_signal;
use std::sync::RwLock;
use synchronoise::SignalEvent;
use crate::image_action::{png::SavePng, wait_for_signal::WaitForSignal};
use crate::{
config::{Config, ImageAction as CImageAction},
error::TracerError,
};
pub trait ImageAction: Send + Sync {
fn action(
&self,
screen_buffer: &RwLock<Vec<u32>>,
event: &SignalEvent,
config: &Config,
) -> Result<(), TracerError>;
}
impl From<&CImageAction> for Box<dyn ImageAction> {
fn from(image_action: &CImageAction) -> Self {
match image_action {
CImageAction::WaitForSignal => Box::new(WaitForSignal {}),
CImageAction::SavePng => Box::new(SavePng {}),
}
}
}
|