From 2b05abea03cdaca42b0ab69852799ee1542b467f Mon Sep 17 00:00:00 2001 From: u <@> Date: Wed, 11 Mar 2026 10:07:13 -0700 Subject: build-std, give up on transmute dance the file is streamed anyway. build-std was failing with workers 0.7 but they fixed it? maybe rustup update fixed it and my stuff was mismatched. idk. its annoying --- src/lib.rs | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) (limited to 'src/lib.rs') diff --git a/src/lib.rs b/src/lib.rs index 52169b4..6322e6d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -5,7 +5,6 @@ #![allow(internal_features)] #![allow(mutable_transmutes)] use maud::{html, Markup, PreEscaped, DOCTYPE}; -use std::mem::{take, transmute}; use worker::*; pub mod dateparse; @@ -15,20 +14,6 @@ use crate::{ solar::{dow, solar}, }; -async fn text(r: &mut Response) -> Result { - match r.body() { - ResponseBody::Body(bytes) => unsafe { - let bytes: &mut Vec = transmute(bytes); - Ok(String::from_utf8_unchecked(take(bytes))) - }, - ResponseBody::Empty => Ok(String::new()), - ResponseBody::Stream(_) => unsafe { - let bytes = r.bytes().await?; - Ok(String::from_utf8_unchecked(bytes)) - }, - } -} - #[event(fetch)] async fn fetch(req: Request, env: Env, _ctx: Context) -> Result { Router::new() @@ -36,7 +21,7 @@ async fn fetch(req: Request, env: Env, _ctx: Context) -> Result { let u = req.url()?; let a = ctx.env.assets("ASSETS")?; let mut a = a.fetch(u.join("_/diary")?, None).await?; - let a = text(&mut a).await?; + let a = unsafe { String::from_utf8_unchecked(a.bytes().await?) }; bone("shitpit", "look in the sky! it's a bird! it's a plane! no it's superego!", html! { p { "The numbering system for people (#1, #2, ...) is arbitrary and " -- cgit v1.2.3