*rubbing eyes* Anyone use "Rocket"?

The worst/most Ruby-like thing about Rocket is when you return a value from a Route function, you just kinda return… whatever datatype you want, and Rocket figures it out.

Unless it doesn't, and you have *no* idea what to return.

For a string, you return a String.

What do I return for bytes? It's not a string, it's a &[u8; 1335895] and it's not valid UTF-8. Do I return a rocket::response::ByteStream? That seems to be the correct answer but doesn't work


error[E0277]: the trait bound `&[u8; 1335895]: Stream` is not satisfied
  --> server/src/pages.rs:33:1
   |
33 | pub async fn get_wasm_2() -> Result<(ContentType, ByteStream![&'static [u8]]), Status> {
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Stream` is not implemented for `&[u8; 1335895]`
   |
0

If you have a fediverse account, you can quote this note from your own instance. Search https://mastodon.social/users/mcc/statuses/116037059162356007 on your instance and quote it. (Note that quoting is not supported in Mastodon.)