Posts
174
Following
390
Followers
314
Dr. WiFi. Linux kernel hacker at Red Hat. Networking, XDP, etc. He/Him.
re: Impressions learning Rust
Show content
@pmmeurcatpics yeah, not surprising! Certainly tracks with the experience I mentioned in the last post: you sorta run into this brick wall of type representation which you have you scale before you can do really useful things. Takes a bit of persistence to do, I suppose...
0
0
1
Impressions learning Rust
Show content
@shtrom haha, yeah, didn't run into anywhere that I needed to wrap anything, but I can certainly see why it makes sense to avoid that by default. Humans don't generally think about numbers as wrapping!

(To be slightly pedantic, *unsigned* integer wrapping is not strictly speaking undefined behaviour in C, only signed[0], but that doesn't mean it can't lead to surprising bugs...)

[0] https://www.gnu.org/software/autoconf/manual/autoconf-2.63/html_node/Integer-Overflow-Basics.html
0
0
1
Impressions learning Rust
Show content
@isomer I have not! Will give that a shot, thanks for the tip :)
0
0
0

Tangential thought:

A really funny thing is almost everything good about Rust comes down to when it was written. It has excellent LLVM integration because it was written right after LLVM happened. It has a good build system because the build system was written after pip and npm. It has great libraries because all the libraries were written between 2020 and 2024 and so they're all modern. Not sure where I'm going with this but it makes me wonder how Rust will age.

"How Rust will age". Heh.

3
1
0
Impressions learning Rust
Show content
If anyone is interested in the tool I built for this exercise, it's a simple DNS updater tool (for RFC 2136 updates):

https://github.com/tohojo/update-dns

I spent quite a bit of extra time on polish to make the code shorter and more readable as I learned more about various Rust constructs, but I have no idea if I succeeded in getting anywhere close to 'idiomatic Rust', if such a thing exists. So comments from more experienced Rustaceans are very welcome!

8/
1
0
2
Christmas PSA about not being a dick
Show content

With today being Christmas, here is your annual reminder to be nice to newbies in your spaces.

There is going to be a very sudden influx of people who are just getting into the spaces you occupy because they got a gift that acts as their gateway into that activity. Maybe you're into photography and someone just bought them their first ever camera body, or you're into music and someone bought them their first guitar, or you're an audiophile and someone bought them their first really nice headphones, or you're big into TTRPGs and someone just bought them their first ever core rulebook.

Whatever the specific activity and gift, these people are going to have no idea what they're doing, they're going to ask a lot of obvious questions, they're going to make a lot of rookie mistakes, and there's going to be a lot of them.

I cannot stress this enough: BE NICE TO THEM.

Few things will ruin someone's enjoyment of something faster than trying to join its community and getting such a rude first impression that their conclusion is "People who like this are kind of assholes. I don't think I want to do this if it's going to involve getting yelled at." Craigslist and eBay and FB Marketplace will be filled with mint condition gifts being resold to attest to this in the coming months.

You were there at the very first step once. Be the person for them that you wish you had back then. (Or if you were lucky enough, the person you did have who fostered your love of it!) Make this something they'll love just as much as you do, not something they'll want to sell and get away from as soon as possible.

Be the reason this Christmas starts a lifelong passion for them, not the reason they decide to abandon something that they would've loved because people made them feel bad for needing a helping hand.

0
15
0

Toke Høiland-Jørgensen

Edited 2 days ago
Impressions learning Rust
Show content
In retrospect, I think that one of the hurdles coming to Rust from C is that Rust forces you to do things right wrt representing everything with the right types, and manipulating them according to the rules of the type system. Which requires wrapping your head around a lot of different things at the same time before you can make any progress.

But once you *do* wrap your head around it, you get a kind of phase change feeling: suddenly things go from being obtuse and frustrating to being straight forward, and you really start to feel the power of the type system work in your favour. Which is very cool, and really shows the power of the language!

Oh, and the "when it compiles, it works" thing is definitely real; I spent very little time debugging weird runtime errors once things were actually compiling!

7/
2
2
5
Impressions learning Rust
Show content
Coming from C, error handling is another thing that takes a little getting used to. I started out doing the same thing I would do in C: have each function log an error if something goes wrong, and then return an error code.

But in Rust, you can attach the error message to the error code! With a little help from the 'anyhow' crate this becomes really easy, and you can just return errors all the way up the call stack, and if you also return them from the main function, Rust will helpfully print an error message and exit non-zero.

(For libraries you'd want typed errors, but for a CLI app like I was building, this pattern of just bubbling up the error messages works really well. The context/with_context helpers from the anyhow crate help where the default errors are not too helpful).

6/
1
1
3
Impressions learning Rust
Show content
Speaking of type safety - the Rust type system is obviously one of the things that takes a while to wrap your head around. But once you do, its power soon becomes apparent!

Especially the various safe conversion functions that can convert types to each other with from/into/parse.

Parsing an IP address? Just specify an IP address-typed variable and assign string.parse() to it, and presto! the compiler will figure out the right parser function to call, and you'll end up with the right type of variable (you still have to handle errors, though).

5/
1
0
1
Impressions learning Rust
Show content
On the subject of common crates, I am really impressed with the quality of the Rust libraries I ended up using for my small application (a simple command line utility that does dynamic DNS updates).

The clap and serde libraries for command line parsing and data (de)serialisation are great examples of this.

Simply define some structs, sprinkle a couple of macros across the members, and bam! Full featured command line argument parsing and YAML config file parsing, with the results being completely type safe and validated. All easily grok'able from the crate docs, that also have great examples to work from. Impressive!

4/
1
0
1

Toke Høiland-Jørgensen

Edited 2 days ago
Impressions learning Rust
Show content

Another thing that helped me was to start with something other than a complete beginner’s tutorial.

The Rust for C Programmers book is a great resource for someone with existing C experience; it explains the core Rust concepts concisely and in a way that makes it easy to lookup things as needed.

The other resource that was very helpful was the Blessed.rs curated list of common crates.

3/

1
0
3
Impressions learning Rust
Show content
First of all, I feel like the Rust ecosystem has significantly improved since the last time I tried this a couple of years ago: The compiler error messages are more helpful, documentation is better, common libraries are more comprehensive in their functionality. This is all very helpful for someone new to the ecosystem!

2/
1
0
1

Toke Høiland-Jørgensen

Impressions learning Rust
Show content
I've been meaning to sit down and learn Rust for a while, and have made a few attempts, but it never seemed to click in a way that stuck.

Well, the holidays have afforded me with several days in a cabin in Norway with no particular plans, which nicely lent itself to giving this another go.

Although I obviously haven't mastered the language yet, I do feel like it has clicked in a way that it hasn't before. I figured I'd share a couple of impressions from the experience here.

1/
2
8
16

oh wow, anna's archive "backed up" Spotify! they downloded 256 million songs - roughly 300TB - so you could technically, make your own spotify at home! would easily fit in a 2RU server, hmmmmm

https://annas-archive.li/blog/backing-up-spotify.html

2
3
0

It's not just economic power, it's digital coercion. We have to get our institutions weaned off of US-based software and platforms, including Microsoft, Meta, Google, Xitter, and more. Open source is the answer! https://www.theguardian.com/world/2025/dec/12/danish-intelligence-accuse-the-us-of-using-economic-power-to-assert-will-over-allies

1
5
0

The end of the kernel Rust experiment

https://lwn.net/Articles/1049831/

2
8
1

Some reporting on excellent news about:

the physics professor who became Uruguay's energy secretary, and within five years had the country on 98% renewable energy.

and economically it was a smash hit

the cost of electricity production decreased by roughly half compared to fossil-fuel alternatives, and the country attracted $6 billion in renewable energy investments

Going forward,

He hopes to help 50 countries move to renewables over the next ten years. He said, "We want to prove that an energy transition can be possible in different geographies and can work in different national energy and political contexts."

https://mastodon.social/@rubenbolling/115691564369915601

0
3
0
Edited 18 days ago

This is a really excellent non-fiction piece by @WeirdWriter about a writing group with a tech bro:

https://sightlessscribbles.com/the-colonization-of-confidence

It is a distilled essence of the social and cultural damage AI/LLM is causing, how AI promoters are cynically destroying people's confidence in their own humanity, while simultaneously trying to ridicule and other people who point out that AI is bullshit. (And this isn't even mentioning the environmental consequences.)

2
3
0

May is Seasonally Seasoned

Edited 17 days ago

I need you to stop scrolling and read the most human piece of writing I've read in a very, very long time.

https://sightlessscribbles.com/the-colonization-of-confidence/

Thanks, @WeirdWriter.

Edit: If you feel like you got a lot out of this piece, I'm sure Rob would definitely appreciate some subscribers to his newsletter and tips/a paid subscription if you can afford it! It's not easy making a living as a writer.

https://sightlessscribbles.com/support/

20
7
0

giving impressionable still-developing young men "ai girlfriends" who cannot ever say no and that they can customize with sliders and parameters down to minuscule detail will probably break them in unfixable ways and permanently foreclose on their healthy participation in human relationships but beep boop what does computer know

0
6
0
Show older