
h2: HTTP 2.0 client and server implementation for Rust - guifortaine
https://github.com/carllerche/h2
======
reificator
I've been wanting to jump into Rust for many years now, because I love working
on systems level code and Rust seems like it will eventually be a no-brainer
choice.

I waited until it hit 1.0, and then I waited a bit more, played around a bit
here and there with the intent of getting a feel for it. Then last week I
started taking it seriously and working on learning it for real.

Seeing more and more libraries popping up for the basics makes me feel like I
made the right choice. Sure I'm not going to use the crate today because of
the multiple warnings in the README, but things are sprouting up at a good
rate.

I feel like once I've got a nice fun sideproject built in Rust, and then move
to looking for employment in that space, things will be coming together
nicely.

I don't know how to word it better than "I think I chose the right moment to
hop aboard."

~~~
pducks32
You jumped on while it’s on the up and up.

~~~
joshbaptiste
if you're still looking around, you want to have a look at Nim, an alternative
systems programming language with optional GC. [https://nim-
lang.org/](https://nim-lang.org/)

~~~
reificator
Thanks for the heads up, but meaningful whitespace means I'm not likely to
look too closely at it. The use of invisible characters to determine control
flow is not something I'm a fan of.

Here's a post I made on the topic a few months ago:
[https://news.ycombinator.com/item?id=15251078](https://news.ycombinator.com/item?id=15251078)

Take note of how the reply that tried to play with whitespace was already
broken by HN's code formatting.

EDIT:

Beyond whitespace sensitivity:

* It compiles to an intermediary language rather than leveraging something like LLVM.

* Despite having sum types it appears that idomatic Nim uses null pointers.

* I'm seeing that it disallows pointer arithmetic in the same search results page that links to a runnable example of pointer arithmetic.

* It uses exceptions, which obscure control flow and make grokking code much more difficult IMO.

* Bindings are mutable by default.

I'm not seeing a good reason to use Nim over Rust in the places where I would
use Rust. (For personal use: game development)

I could see it being competitive with where I use Go, but with whitespace
sensitivity, exceptions instead of error values, and compiling to C, I'm not
even sold on using it there.

~~~
earenndil
How about D[1] or possibly ante[2]? Ante has significant whitespace (sorry),
BUT it has fancy macros. Goto is implemented as a macro, for instance.

1: [https://dlang.org/](https://dlang.org/) 2:
[https://github.com/jfecher/ante](https://github.com/jfecher/ante)

~~~
reificator
Note that I did edit the above post as you were replying.

Also I should note that I'm writing this from the perspective of developing
game engine style code.

D:

* D's garbage collector can be switched off, but last I checked (to be fair a few years ago) this even locked you out of parts of the stdlib. For smaller game engine projects, this is an issue. For larger ones, they often rewrite the stdlib anyway, though I'd expect growing pains while bootstrapping up to that point.

* Memory safety guarantees appear to be much stronger in Rust than in D. The difference in approach demonstrates this well I think, Rust has an `unsafe` keyword while D has a `@safe` attribute.

* It's great at its goal, which is to be (C++)++. It sidesteps a lot of the problems found in C++ and appears much more intentionally designed.

* Despite a 7-8 year headstart for D, from the outside of both communities the Rust community appears much more vibrant.

I've not heard of Ante, I'll go take a look.

~~~
earenndil
> D's garbage collector can be switched off, but last I checked (to be fair a
> few years ago) this even locked you out of parts of the stdlib. For smaller
> game engine projects, this is an issue. For larger ones, they often rewrite
> the stdlib anyway, though I'd expect growing pains while bootstrapping up to
> that point.

Yeah, that is a problem -- albeit one that people are currently working on
fixing. Look at BetterC[1]. And I've heard rumours someone is rewriting the GC
to be much more performant? And if nothing else, you can just stop the GC and
manually collect your own memory, and a smart pointer implementation is
probably relatively simple.

However, is the GC even a problem? You know what they say about premature
optimization.

1: [https://dlang.org/spec/betterc.html](https://dlang.org/spec/betterc.html)

~~~
reificator
I've spent enough time writing games in various GCed languages, and GC has
been an issue in all of them. It's less about the optimization of the actual
pause time and more about trying to make sure that things are as deterministic
as possible for debugging's sake. Though the pause is of course an issue as
well.

------
MrBuddyCasino
I once ported nghttp2 to the ESP32, that was _not fun_. Anyone got a clue
about memory consumption of this?

~~~
eximius
Rust binaries are not terribly small and this likely isn't `no_std`.

What order of magnitude would you need?

~~~
MrBuddyCasino
I see. 2 MB flash and 200k ram are max. But no_std would probably be a
requisite.

Nghttp2 does no I/O itself so is very portable and efficient, was hoping for
something similar.

