-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add HTMLStream #2725
Comments
What exactly would you want |
Closing for the above. |
Unfortunately, it's too cumbersome to use (in my opinion). I'd expect rocket to contain a macro you can use like this: HTMLStream! {
yield "<html>";
yield "<some><more>";
yield "</html>";
} Especially given that there are macros like |
I'm suggesting that you can today do: RawHtml(TextStream! {
yield "<html>";
yield "<some><more>";
yield "</html>";
}) I don't believe this is too cumbersome. |
Oh I thought it was much harder to use this, thanks for the code snippet! I'm still new to Rust and things still look magical to me :D |
What's missing?
Rocket provides easy to use stream macros for
ByteStream
TextStream
EventStream
however, there is no implementation for
HTML
based streams. This should definitely be added as HTML can also be used to stream data.Ideal Solution
Add a
HTMLStream
that return a stream usingContentType::HTML
.Why can't this be implemented outside of Rocket?
As there are other streams available, even some "exotic" ones, such as
EventStream
, basicHTML
should definitely be supported by rocket.Are there workarounds usable today?
Probably, I guess you could copy the code from https://api.rocket.rs/v0.5-rc/src/rocket/response/stream/text.rs.html#56 and replace it with
HTML
. I tried to do that, unfortunately I do not know near enough about Rust to make this to work :(Alternative Solutions
No response
Additional Context
No response
System Checks
The text was updated successfully, but these errors were encountered: