From 5921ea93908abfef6f7f8befe7d5585936f33043 Mon Sep 17 00:00:00 2001 From: Rob Herley Date: Sat, 18 Jan 2025 16:30:32 -0500 Subject: [PATCH] cleanup --- src/main.rs | 22 +++++++++++++++++++--- src/streams/output.rs | 2 +- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/src/main.rs b/src/main.rs index b2b6f6a..7fcc329 100644 --- a/src/main.rs +++ b/src/main.rs @@ -66,8 +66,7 @@ async fn handle(mut body: web::Payload) -> Result { } } - let chunk = actix_web::web::Bytes::from(item); - if let Err(e) = body_tx.send(Ok(chunk)).await { + if let Err(e) = body_tx.send(Ok(item)).await { warn!("unable to send chunk: {:?}", e); break; } @@ -91,7 +90,7 @@ async fn handle(mut body: web::Payload) -> Result { } #[actix_web::main] -async fn main() -> std::io::Result<()> { +async fn main2() -> std::io::Result<()> { env_logger::Builder::from_env(env_logger::Env::default().default_filter_or("info")) .filter_module("wasmtime_wasi", log::LevelFilter::Warn) .filter_module("tracing", log::LevelFilter::Warn) @@ -108,3 +107,20 @@ async fn main() -> std::io::Result<()> { .run() .await } + +fn thing() -> Result> { + return Ok(1); +} + +fn main() { + let res = match foo() { + Ok(v) => v, + Err(e) => { + eprintln!("error: {}", e); + return err; + } + }; + + std::process::exit(res); + } +} diff --git a/src/streams/output.rs b/src/streams/output.rs index e914e3f..2dedb39 100644 --- a/src/streams/output.rs +++ b/src/streams/output.rs @@ -41,7 +41,7 @@ impl HostOutputStream for OutputStream { return Ok(()); } - match self.tx.try_send(Bytes::from(buf)) { + match self.tx.try_send(buf) { Ok(()) => Ok(()), Err(err) => { error!("failed to send chunk: {:?}", err);