
Rocket v0.4: Typed URIs, Database Support, Revamped Queries - sbenitez
https://rocket.rs/v0.4/news/2018-12-08-version-0.4/
======
gtycomb
I am truly moved by what this small (probably one, maybe two person?) team has
accomplished here. Just look at their code and its organization, while noting
how languages like Rust, Nim, and Go show us how to tackle the software
complexity in various software domains. Having been in the enterprise field
for a handful of decades, I am convinced that work such as this is signaling a
brave new world of software development that is just ahead of us -- small
teams, phenomenal productivity, which needs to combine with a grasp of
architecture processes to taken on complex IT stuff. After having been in the
SAP, Dessault PLM, and Oracle database-centric industries for some decades
now, and I am convinced that a new generation of software software engineers
with imagination and willingness to learn aspects of the businesses they
serve, they will take on these sprawling legacy systems with much less effort
than we think it should take right now. Exiting times are ahead for those who
use these opportunities, I'd say.

~~~
wongarsu
> a brave new world of software development that is just ahead of us -- small
> teams, phenomenal productivity

It's also the brave new world that lies behind us. Doom, one of the most
influential computer games due to technical innovation, was created by a team
of 3 programmers (and 8 non-programmers).

Small teams of brilliant people can produce phenonemal results. Unfortunately
in big companies a manager is not only measured by his results, but also by
his budget and the number of people under him. The division of 100 people
simply looks more impressive than the room of 10. So you end up hiring lots of
(at best) mediocre programmers, pay them as little as possible, and use big
architectures and processes designed to cope with idiots (Enterprise
architectures and Enterprise processes, as we call them).

~~~
mr_overalls
Calling anyone who isn't brilliant an idiot is a bit. . . uncharitable. Most
of us here, myself included, (and probably you) are not rockstar/ninja
programmers.

------
Reisen
There's some super exciting stuff in this release, but what caught my eye was
this:

> Aynchronous Request Handling (#17) > > In 0.5, Rocket will migrate to the
> latest asynchronous version of hyperand futures with compatibility for
> async/await syntax. Of utmost importance is preserving Rocket's usability.
> As such, these changes will be largely internal, with asynchronous I/O
> peeking over the covers only when explicitly desired or required. As a side
> effect, we expect a substantial performance boost from the migration as well
> as resolution to long-standing issues.

Lacking async was my main reason at the time for switching out a hobby project
from Rocket to Actix, It's exciting to see that this might change soon as
Rocket really just hits the nail on the head when it comes to useability. It
_feels_ fantastic compared to so many frameworks both in Rust and other
languages.

~~~
woah
I don’t really understand this. Futures don’t “peak from under the covers”
they hit you over the head with syntax. And iirc Rocket uses a thread per
request model.

So I’m guessing they have optimized their threaded model with futures, plus
given you the ability to turn on a non blocking mode, but your routes will
need to use futures if you do that?

------
Dowwie
All of this is done while pursuing a computer science PhD at Stanford,
teaching, and other life activities. Sergio has been digging deep for a really
long time. It is great to see that others are helping to advance Rocket's
mission but as with most open source projects, the primary author moves it
forward. This release isn't just about new features or rewrites. It's about
passion for one's work. It's about grit. It's about uncompromising commitment
to excellence.

While there will ever be only one Sergio in the world, there are many others
in the broader Rust community who are signaling many of the same positive
qualities. The signal is only increasing in strength as new talent adopts the
language for critical path work.

I am more optimistic than ever about Rust as a tool for general use, not just
because of the tools but because of the leadership in its community.

------
hermanradtke
Once rocket makes it to stable, I think it will be the go to choice for web
development in Rust. The focus on creating a great developer story makes
rocket a joy to use.

I am shocked that Sergio maintained rocket alone for so long. I would have
figured there was a team of 3-4 people working on rocket. Glad to see he is
getting help!

~~~
vhakulinen
I'm really eager to push for use of rocket (and thus rust) at work, but while
rocket being on version 0.x it probably is a tough sell. The benefits rocket
(at least seems to) bring feels obvious and I notice every now and then at
work that "hey, this would be so easy to do with rocket".

~~~
grayrest
As a whole, Rust developers see 1.0 as a stability commitment and to my
knowledge, everybody (well, not Rouille) wants to be async and depend on
Futures 1.0. I believe Futures 0.3 is most of the way to where the Futures
team wants 1.0 to be and the initial roadmap was trying for 1.0 in 2018 so my
uninformed guess is that we'll see Futures 1.0 in the first half of 2019. I
expect the whole Rust network server ecosystem to shift around over the coming
months as Futures and async/await come online in the next few months.

~~~
steveklabnik
So, Futures are moving into the standard library; there’s been a last minute
procedural issue over one name, and then they’ll be in. So “futures 1.0” isn’t
as important, the futures library mostly provides extra utilities, not the
core of futures themselves. It’s likely this means they’ll be in 1.33,
February 28 (if my math is right)

~~~
Matthias247
> So, Futures are moving into the standard library; there’s been a last minute
> procedural issue over one name, and then they’ll be in.

That's just the open issue around pinning.

There are however a few open discussions around the futures/task/waker parts,
from the other RFC. I just wrote down a list of the open points here:
[https://github.com/aturon/rfcs/pull/15#issuecomment-44549238...](https://github.com/aturon/rfcs/pull/15#issuecomment-445492382)

~~~
steveklabnik
Oh right, I forgot about that but, thank you!

------
plainOldText
I've toyed with various Rust web frameworks and I think rocket is one of the
most promising. A thought out, high quality project. The person behind it
strikes me as someone who pays attention to details, from the codebase, docs,
all the way to the presentational website. Kudos!

~~~
zanny
I lurk the Matrix room for Rocket and I have no idea where Sergio finds the
time to near single handedly develop a huge web framework while helping at
least a dozen people a day get into it on the IRC.

------
osrec
I've never tried Rust or Rocket, but it appears to be gaining popularity, so I
have the following questions for existing users:

What's it like to work with? Do you prefer it to JS/PHP/Python for web related
projects?

Can you iterate on code quickly, or is there a compile step on every
iteration?

Are there stable libraries for interacting with MySQL/Redis/Postgres
asynchronously?

Is there good IDE support, for example in Atom?

Thanks!

~~~
jlangenauer
It's a bit rough to work with still - the IDE support is still a work in
progress (though improving) and there is a compile step with every iteration
(incremental compilation has improved this too).

Diesel is the main library for interacting with SQL databases, it wasn't async
last time I used it, and a quick web search tells me it still isn't - this has
been a BIG problem with Rust over the last year, as everyone waits for the
async implementation to finally become stable.

Rust is a funny beast at the moment - you have to deal with the learning
curve, you have to deal with the unstable/pre-1.0 libraries (some of which are
fine), you have to deal with all the errors the compiler throws at you.

But once you've done all that, something magical happens: you end up with
software that is mind-blowingly stable and blazingly fast. It doesn't throw
segfaults, it doesn't leak memory, it just works, and works amazingly well.

~~~
hayd
Isn't diesel being sync largely hid behind a connection/thread pool? Generally
you want to limit the connections to the database anyway, so a connection pool
is desirable...

~~~
TheCoelacanth
Aren't those orthogonal concerns? A connection pool lets you share the same
connection across multiple threads of execution. Async lets you share the same
thread of execution across multiple actions waiting for IO to happen. For the
best performance, you want both.

------
matt2000
Is anyone able to lay out some of the reasons why you might want to write web
applications in rust? I was under the impression rust was designed as a safer
language for low level systems programming. Thanks!

~~~
AsyncAwait
I'd say that in all the talk of Rust being a C replacement, what gets lost is
that it is also a very expressive, modern, functionally flavored language,
perfectly suitable for higher-level programming.

If you want type safety, speed, expressive language & native binaries, Rust is
a good choice.

~~~
IshKebab
Sure, however you do pay the _significant_ cost of having to satisfy the
borrow checker. There are other nice expressive languages where you don't have
to do that so if you actually don't need the speed Rust is maybe not the best
choice.

~~~
AsyncAwait
> you do pay the significant cost of having to satisfy the borrow checker

Right, but this is presumably a one-time investment while learning Rust, much
less of an ongoing hurdle.

~~~
IshKebab
I disagree. It's something you always have to think about. It might get easier
but it doesn't magically go away.

~~~
AsyncAwait
You often _should_ think about it in other languages too, ie to avoid
concurrency bugs. If you don't, there's a good chance your program isn't
correct, even if accepted by a less strict compiler.

~~~
IshKebab
Yes. But the point is that you don't have to "dumb down" your program to prove
to a static analyser that it is correct.

Look at the kind of programs that NLL now allows. You wouldn't have to jump
through those hoops in another language.

------
leoh
It concerns me that you have to use a Rust nightly build to use Rocket. Am I
off the mark on being concerned about this?

~~~
leshow
AFAIK Rocket has always been focused on developing an ergonomic type safe API
to building web applications. Many things it depends on, codegen, proc macros,
that sort of thing, are yet to be stabilized. I'm not affiliated with the
project, this is just what I've read about it.

There are other frameworks you can use if you want to use stable, many of them
are async already. Granted, none are really 'mature', but this is a new-ish
space for Rust anyway.

~~~
steveklabnik
Most of that stuff is now stable; the major thing it’s waiting on is a fairly
technical detail that gives Rocket more informative errors. If Sergio was
willing to regress a bit there, it could be on stable, in my understanding.
But developer experience is kind of the whole point, so he’s making the call
to wait longer.

(EDIT: I just reviewed the flag list and I am 99% sure this is true; the never
type could use a library instead, and I am pretty (but not %100) sure
proc_macro_hack could fix the other one. It’s quite possible I’m wrong, but in
the end, it’s still basically three features left to go.)

------
throwaway487551
With all due respect, 166 packages to compile for a 5 line hello-word is so
Nodejsy. It is a smell, a red flag. We should learn more from Go and Erlang.

I hope the Tide will do.

~~~
jake_the_third
>166

Yikes!

Does anyone know where I can get an overview of the entirety of rocket's
dependency graph. Crates.io only lists 11 direct dependencies.

~~~
TimNN
You can use the `cargo graph` [0] command to get a graphviz view of the
dependency graph. The `Cargo.lock` file which Cargo generates should also
contain all the information you want in machine-readable form.

[0]: [https://github.com/kbknapp/cargo-
graph](https://github.com/kbknapp/cargo-graph)

------
InGodsName
Did anyone manage to build a SaaS product in Rocket yet?

Looking for ActiveMerchant equivalent in Rust.

How do you handle subscription billing?

