summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoru <@>2026-03-11 10:07:13 -0700
committeru <@>2026-03-11 10:09:14 -0700
commit2b05abea03cdaca42b0ab69852799ee1542b467f (patch)
treed2fb7786eccb60afec15f95ab44ffb6b761dedd2 /src
parent9bdd9eb5442bbdeefa08ea60fd966c8f9a83c543 (diff)
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
Diffstat (limited to 'src')
-rw-r--r--src/lib.rs17
1 files changed, 1 insertions, 16 deletions
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<String> {
- match r.body() {
- ResponseBody::Body(bytes) => unsafe {
- let bytes: &mut Vec<u8> = 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<Response> {
Router::new()
@@ -36,7 +21,7 @@ async fn fetch(req: Request, env: Env, _ctx: Context) -> Result<Response> {
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 "