Live data from Hacker News

Rocket, Rust Web Framework, v0.2: Managed State and More

rocket.rs

11–20 of 62 posts

Re: Rocket, Rust Web Framework, v0.2: Managed State and More

#11
post #7
post #6

Earlier quoted context omitted.

SSL is really not the responsibility of the web framework.

Are reverse proxies always the way to go?

In the age of "microservices" it seems to be the direction. Also, in any HA deployment, would generally be the case anyway.

Re: Rocket, Rust Web Framework, v0.2: Managed State and More

#12
post #5

Just curious, I really want to like Rust but take a look at the State API documentation for managed state feature: https://api.rocket.rs/rocket/struct.State.html (screenshot: http://c.ekin.io/3c2q112x1p0y ) Is this readable to Rust people? I mean, can you look at this and say, "ah ok, I'm gonna call this and that then I'll have the state" directly? I'm lost but I have zero Rust knowledge so this is a sincere question…

Yeah, it's reasonably understandable.

In fact it's a pretty awesome example of Rust's traits in practice since it requires Sync + Send so you know it needs to be thread safe(and the type system will enforce it).

Re: Rocket, Rust Web Framework, v0.2: Managed State and More

#15
post #5

Just curious, I really want to like Rust but take a look at the State API documentation for managed state feature: https://api.rocket.rs/rocket/struct.State.html (screenshot: http://c.ekin.io/3c2q112x1p0y ) Is this readable to Rust people? I mean, can you look at this and say, "ah ok, I'm gonna call this and that then I'll have the state" directly? I'm lost but I have zero Rust knowledge so this is a sincere question…

It is readable, but you are right it is terribly formatted with a lot of not-very-important information in huge fonts.

I think rustdoc needs quite a lot of work in general. For example it doesn't even give a list of methods at the start of each type's page. Want to know which methods you can call on a `String`? Enjoy scrolling...

https://doc.rust-lang.org/std/string/struct.String.html

Re: Rocket, Rust Web Framework, v0.2: Managed State and More

#16
post #5

Just curious, I really want to like Rust but take a look at the State API documentation for managed state feature: https://api.rocket.rs/rocket/struct.State.html (screenshot: http://c.ekin.io/3c2q112x1p0y ) Is this readable to Rust people? I mean, can you look at this and say, "ah ok, I'm gonna call this and that then I'll have the state" directly? I'm lost but I have zero Rust knowledge so this is a sincere question…

It is readable, but you are right it is terribly formatted with a lot of not-very-important information in huge fonts. I think rustdoc needs quite a lot of work in general. For example it doesn't even give a list of methods at the start of each type's page. Want to know which methods you can call on a `String`? Enjoy scrolling... https://doc.rust-lang.org/std/string/struct.String.html

The +/- button will do that for you. It's one of the first things I do once I read the top example.

Re: Rocket, Rust Web Framework, v0.2: Managed State and More

#18
post #7
post #6

Earlier quoted context omitted.

SSL is really not the responsibility of the web framework.

Are reverse proxies always the way to go?

No. Usually web application would be exposed through FastCGI or similar protocol.

Insisting that either your tiny web application that can do next to nothing is the thing that owns 80/tcp (and/or 443/tcp) or runs behind a HTTP proxy is stupid. Proxying HTTP requests properly is harder than it sounds, which is surprising every now and then and thus is easy to screw up (what happens to Host: header? who is the TCP client? is it HTTP or HTTPs?), and your tiny web application, as I've called it, is not the only thing I want to host on the machine.

Re: Rocket, Rust Web Framework, v0.2: Managed State and More

#20

I'm curious what's the difference between Managed State and good old Dependency Injection. Is it just a naming difference? In that case, why? People already know what DI is.

While I could see that this implementation of Managed State is an example of DI, the opposite is not true.
Post reply on HN