Rust by Example

Rust is a modern systems programming language focusing on safety, speed, and concurrency. It accomplishes these goals by being memory safe without using garbage collection.

Rust by Example (RBE) is a collection of runnable examples that illustrate various Rust concepts and standard libraries. To get even more out of these examples, don’t forget to install Rust locally and check out the official docs. Additionally for the curious, you can also check out the source code for this site.

Now let’s begin!

Running Rust on the Rumprun unikernel

“The Rust programming language has been able to run on bare-metal without the standard library for quite some while now. However, most Rust applications depend on the std crate, and therefore still need a full operating system to run.

This is where the Rumprun unikernel platform comes into play. It allows you to build your POSIX applications into bootable single-purpose images. Because unikernels are tailored to run a single application, they come without the footprint of a full-featured operating system. This makes them a great tool for application virtualization. Supported platforms of Rumprun include not only Xen/EC2 and KVM, but you can also run your image on bare-metal hardware.

Rumprun is based on rump kernels, it reuses NetBSD’s libc and drivers as components to provide a POSIX-y interface – the interface which the Rust standard library is built upon.

For the last couple of days we have been working on Rumprun support for Rust – you can now deploy your Rust application as a Rumprun unikernel. With our toolchain set up, a single cargo command is all you need to turn your Rust application into a Rumprun unikernel image…”

Rust for Python Programmers

“Now that Rust 1.0 is out and quite stable, I thought it might be interesting to write an introduction to Rust for Python programmers. This guide goes over the basics of the language and compares different constructs and how they behave.

Rust language wise is a completely different beast compared to Python. Not just because one is a compiled language and the other one is interpreted, but also because the principles that go into them are completely different. However as different as the languages might be at the core, they share a lot in regards to ideas for how APIs should work. As a Python programmer a lot of concepts should feel very familiar…”

A Taste of Rust

“The word rust is the last thing I want to think about when I am hungry and/or fantasizing about building something that will endure through the ages. As a name for a programming language, “Rust” doesn’t exactly inspire confidence, but to take your mind off of ancient AMC Pacers and eating a bucket full of rusty nails, I’ll let you in on a couple of folk etymologies for the language, only one of which I just made up…”

A Quick Comparison of Nim vs. Rust

Rust and Nim are the two new programming languages I have been following for a while. Shortly after my previous blog post about Rust, Nim 0.10.2 was out. This led me to take a closer look at Nim, and, naturally, compare it with Rust.

In this blog post, I’m going to share my two simple examples written in Nim and Rust, the rough execution time comparison, and my subjective impressions of coding in both…”

60sec Review: Rust Language

“Rust is different. Rust is a statically typed compiled language meant to target the same tasks that you might use C or C++ for today, but it’s whole purpose in life is to promote memory safety. By design, Rust code can’t have dangling pointers, buffer overflows, or a whole host of other memory errors. Any code which would cause this literally can’t be compiled. The language doesn’t allow it. I know it sounds crazy, but it really does work…”

Rust’s Memory Management

“Rust seems to intimidate newcomers, as its memory model is fairly complex. I think part of the problem is that the language tutorial introduces the memory model by feature. Rather, I’ll introduce it by concept, showing examples of code that breaks memory safety in C, and how Rust’s memory model prevents the error. Hopefully I can convince you that Rust isn’t as complex as it looks, and that the extra syntax is well-worth the zero-cost memory safety. I’ll be comparing Rust code to equivalent C idioms using the zeromq library because it has a very clean API in both languages. As such, I assume basic familiarity with C. Rust is not a very suitable language for new programmers, and neither is this tutorial…”