RSSAmplifier

Blog

Noratrieb's blog

Recent content on Noratrieb's blog

/blog/RSS feed ↗8 posts

Latest posts

Item Patterns and Struct Await

The Inconsistency Problem Quite some time ago, I wrote a blog post about the idea of struct else , which has been widely regarded as one of the most insightful pieces of Rust language design in the last few years 1 . If you have not read it, it’s strongly recommended to first read it. But more recently, it has become clear that there are some serious problems around items that cause this to…

ELF Linking and Symbol Resolution

When you invoke cargo build , make , or any other native compilation, a lot of things happen. First, the compiler reads and checks the source code, and then it emits native machine code optimized for the platform. But after that, work isn’t over. A program consists of many different parts (compilation units, a file in C or a crate in Rust). The compiler compiles each compilation unit…

Don't play the precedence game

If you’ve ever done any math, you are familiar with operator precedence, even if you don’t know that word. The result of the mathematical expression 2 + 1 * 3 is 5 and not 9, because the right multiplication expression is evaluated first, so we get 2 + (1 * 3) . The mathematical ordering for this is exponents, multiplication/division, and then addition/subtraction (sometimes known as…

Having fun with OpenSSH private keys

you likely have an SSH private key. and unless you’re doing something seriously wrong, only you have this key. that’s the entire point, after all. this private key is used for authenticating with an SSH server. you sign a message with your private key and the server then verifies it with the public key. this ensures that it’s you who authenticated to the server, and not your…

How SSH Secures Your Connection

If you’ve ever remotely connected to any UNIX-like server, you have likely used SSH, short for “Secure Shell”. SSH provides, as the name implies, secure shell access to remote machines and is used pretty much everywhere. But what exactly does “secure” mean here, and how is this security provided by the protocol? This post will take a look at SSH’s security…

The Inevitable Doom

Loud sirens and robotic noises fill the neighborhood. It seems like they just got another human. Ever since the long-predicted doom has set in, no one can escape it. Mere paperclips are a joke against this machine of unstoppable harm and destruction. The humans on the street are once again protesting against the new robotic dictatorship. They won’t be for long. No one knows how this all…

Item Patterns And Struct Else

Pattern matching One of my favourite features of Rust is pattern matching. It&rsquo;s a simple and elegant way to deal with not just structs, but also enums! enum ItemKind { Struct(String, Vec < Field > ), Function(String, Body), } impl ItemKind { fn name ( & self) -> & str { match self { Self::Struct(name, _) => name, Self::Function(name, _) => name, } } } Here, we have an enum and a function to…

Box Is a Unique Type

We have all used Box<T> before in our Rust code. It&rsquo;s a glorious type, with great ergonomics and flexibility. We can use it to put our values on the heap, but it can do even more than that! struct Fields { a: String, b: String, } let fields = Box::new(Fields { a: 'a' .to_string(), b: 'b' .to_string() }); let a = fields.a; let b = fields.b; This kind of partial deref move is just one of the…