From 91ed6eeb1403e2fc0b639600139a9bf3849cad1e Mon Sep 17 00:00:00 2001 From: Andy Killorin <37423245+Speedy6451@users.noreply.github.com> Date: Sat, 1 Feb 2025 16:24:10 -0500 Subject: [PATCH] moved serialization to encoder --- northbridge/src/main.rs | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/northbridge/src/main.rs b/northbridge/src/main.rs index b5bc4e5..396ee97 100644 --- a/northbridge/src/main.rs +++ b/northbridge/src/main.rs @@ -1,13 +1,9 @@ #![feature(async_closure)] -use std::pin::{pin, Pin}; - use anyhow::{Context, Result}; use common::{Command, Response, BAUDRATE}; -use framed::BoxPayload; use framed_codec::FramedCodec; use futures::{SinkExt, StreamExt}; -use tokio::io::AsyncBufReadExt; use tokio_serial::SerialPortBuilderExt; use tokio_util::codec::Framed; @@ -25,17 +21,11 @@ async fn main() -> Result<()> { Ok(postcard::from_bytes::(&data.ok().context("decode err")?)?) }); - let mut write = write.with(move |data: Command| { - let data = postcard::to_stdvec(&data).unwrap(); - async move {Ok(data)} - }); - while let Some(data) = read.next().await { dbg!(data?); - - write.send(Command::Enable).await; + write.send(Command::Enable).await?; } Ok(())