Remove Stop and Rip commands
This commit is contained in:
parent
c85c4ee14b
commit
a50e0999ca
2 changed files with 0 additions and 18 deletions
|
|
@ -28,8 +28,6 @@ pub trait Drawing {
|
|||
pub struct BoxedDrawing(Box<dyn Drawing + Send>);
|
||||
|
||||
pub enum Command {
|
||||
Stop,
|
||||
Rip,
|
||||
Draw(BoxedDrawing),
|
||||
|
||||
Test,
|
||||
|
|
@ -72,10 +70,6 @@ impl Drawer {
|
|||
|
||||
pub fn run(&mut self) -> anyhow::Result<()> {
|
||||
while let Some(command) = self.rx.blocking_recv() {
|
||||
if matches!(command, Command::Stop) {
|
||||
break;
|
||||
};
|
||||
|
||||
self.on_command(command)?;
|
||||
}
|
||||
Ok(())
|
||||
|
|
@ -83,8 +77,6 @@ impl Drawer {
|
|||
|
||||
fn on_command(&mut self, command: Command) -> anyhow::Result<()> {
|
||||
match command {
|
||||
Command::Stop => {} // Already handled one level above
|
||||
Command::Rip => self.printer.rip()?,
|
||||
Command::Draw(drawing) => drawing.0.draw(&mut self.printer, &mut self.ctx)?,
|
||||
|
||||
Command::Test => self.on_test()?,
|
||||
|
|
|
|||
|
|
@ -23,9 +23,7 @@ struct Server {
|
|||
|
||||
pub async fn run(tx: mpsc::Sender<Command>, addr: String) -> anyhow::Result<()> {
|
||||
let app = Router::new()
|
||||
.route("/stop", post(post_stop))
|
||||
.route("/test", post(post_test))
|
||||
.route("/rip", post(post_rip))
|
||||
.route("/text", post(post_text))
|
||||
.route("/image", post(post_image).fallback(get_static_file))
|
||||
.route("/photo", post(post_photo).fallback(get_static_file))
|
||||
|
|
@ -41,18 +39,10 @@ pub async fn run(tx: mpsc::Sender<Command>, addr: String) -> anyhow::Result<()>
|
|||
Ok(())
|
||||
}
|
||||
|
||||
async fn post_stop(server: State<Server>) {
|
||||
let _ = server.tx.send(Command::Stop).await;
|
||||
}
|
||||
|
||||
async fn post_test(server: State<Server>) {
|
||||
let _ = server.tx.send(Command::Test).await;
|
||||
}
|
||||
|
||||
async fn post_rip(server: State<Server>) {
|
||||
let _ = server.tx.send(Command::Rip).await;
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
struct PostTextForm {
|
||||
text: String,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue