Rust Icon

Rust

Rust is a systems programming language created by Mozilla.
171 Stories
All Topics

Rust ralfj.de

Announcing: MiniRust

Ralf Jung has been thinking about semantics of Rust… a lot:

The purpose of MiniRust is to describe the semantics of an interesting fragment of Rust in a way that is both precise and understandable to as many people as possible… Specifically, MiniRust is specified by a reference interpreter that describes the step-by-step process of executing a MiniRust program, including checking at each step whether the program has Undefined Behavior.

Source code here.

Tooling prql-lang.org

PRQL is a modern language for transforming data

The P in PRQL (pronounced “Prequel”) stands for Pipelined, which I’m convinced is a great way of writing and reasoning about queries:

A PRQL query is a linear pipeline of transformations

Each line of the query is a transformation of the previous line’s result. This makes it easy to read, and simple to write.

It compiles to SQL, which means it’s compatible with most databases already and there are currently bindings for Python, JS & Rust, which is the compiler itself.

Try it out in their web-based playground. (Thanks, Wasm!)

Linux phoronix.com

Linus Torvalds: Rust for the kernel could possibly be merged for Linux 5.20

Speaking this morning at The Linux Foundation’s Open-Source Summit, Linus Torvalds talked up the possibilities of Rust within the Linux kernel and that it could be landing quite soon – possibly even for the next kernel cycle…

The Linux 5.20 merge window will open following the release of Linux 5.19 stable around the end of July, so at that point we’ll see if the Rust PR is submitted and lands for this next kernel version. It wouldn’t be too surprising with how things have been pacing and already having the blessing of Linus.

Lots of positivity about this in the attached comment thread.

Rust tauri.app

Tauri (a cross-platform app toolkit) goes 1.0

Tauri is an app framework built with Rust. You build UIs for it using virtually any frontend JavaScript framework. It has three major tenets: security, privacy, and environment. Speaking to the latter:

The apps you make are lean and performant, which reduces electricity, storage space, and general natural resource consumption. Every byte saved is a leaf on a tree that gets to grow.

This project has gotten a lot of early interest because, well, people have been waiting for an Electron alternative to emerge. Now that Tauri is 1.0 I’m guessing adoption will really start to take off.

Even more good news: we have an episode on Tauri in the hopper for ya 💪

Rust hirrolot.github.io

Rust is hard, or: the misery of mainstream programming

I entered Rust four years ago. To this moment, I co-authored teloxide and dptree, wrote several publications and translated a number of language release announcements. I also managed to write some production code in Rust, and had a chance to speak at one online meetup dedicated to Rust. Still, from time to time I find myself disputing with Rust’s borrow checker and type system for no practical reason. Yes, I am no longer stupefied by such errors as cannot return reference to temporary value – over time, I developed multiple heuristic strategies to cope with lifetimes…

But one recent situation has made me to fail ignominiously.

Rust is hard, or: the misery of mainstream programming

Rust github.com

fclones – an efficient duplicate file finder and remover

Duplicates taking up tons of space on your home NAS? fclones quickly identifies duplicates, even when there’s 10s of thousands that you’re scanning over the network:

fclones treats your data seriously. You can inspect and modify the list of duplicate files before removing them. There is also a –dry-run option that can tell you exactly what changes on the file system would be made.

Also check out the algorithm used to detect duplicates.

Rust github.com

A cross-platform file explorer powered by a virtual distributed filesystem

Spacedrive helps you organize your files across many devices in one place. Here’s the motivation:

Many of us have multiple cloud accounts, drives that aren’t backed up and data at risk of loss. We depend on cloud services like Google Photos and iCloud, but are locked in with limited capacity and almost zero interoperability between services and operating systems. Photo albums shouldn’t be stuck in a device ecosystem, or harvested for advertising data. They should be OS agnostic, permanent and personally owned. Data we create is our legacy, that will long outlive us—open source technology is the only way to ensure we retain absolute control over the data that defines our lives, at unlimited scale.

A cross-platform file explorer powered by a virtual distributed filesystem

The Changelog The Changelog #487

Warp wants to be the terminal of the future

Today we’re talking with Zach Lloyd, founder of Warp — the terminal being re-imagined for the 21st century and beyond. Warp is a blazingly fast, rust-based terminal that’s being designed from the ground up to work like a modern app. We get into all the details — why now is the right time to re-invent the terminal, where they got started, the business they aim to build around Warp, what it’s going to take to gain adoption and grow, but more importantly — what’s Warp like today to get developers excited and give it a try.

Rust blog.adamchalmers.com

What I learned from making a DNS client in Rust

Adam Chalmers:

Over the last few weeks I built my own DNS client. Mostly because I thought dig was kinda clunky. Partly because I wanted to learn more about DNS. So here’s how I built it, and how you can build your own too. It’s a great weekend project, and I learned a lot from finishing it.

DNS is simple enough that you can grok it quickly, but still complex enough that Adam learned a ton along the way: reading RFCs, network sockets, Bitvec, and more.

Bash github.com

A handy way to handle sh/bash CLI parameters

So Argc is a little Rust program that your bash scripts can use to make handling command-line parameters easy. You describe the options, parameters, and subcommands in comments like this:

# @describe A demo cli

# @cmd Upload a file
# @arg target!                      File to upload
upload() {
    echo "cmd                       upload"
    echo "arg:  target              $argc_target"
}

Then you trust Argc to parse that and do the heavy lifting:

eval "$(argc -e $0 "$@")"

The only drawback (aside from potential parsing bugs) to this approach is your script now depends on having argc in the machine’s executable path. i.e. – it’s not portable.

What’d be even cooler, IMHO, would be to instead use argc as a pre-processor of sorts that spits out a pure-bash implementation from your input script. Regardless, a cool idea!

Git github.com

A Git-compatible DVCS that is both simple and powerful

Jujutsu (jj at your CLI) combines features from popular distributed version controls systems (Git, Mercurial, Darcs) with features not found in any of them, such as:

  • working-copy-as-commit
  • undo functionality
  • automatic rebase
  • safe replication via rsync/Dropbox/etc

And since it’s Git-compatible, adoption should be a breeze.

Jujutsu has two backends. One of them is a Git backend (the other is a native one). This lets you use Jujutsu as an alternative interface to Git. The commits you create will look like regular Git commits. You can always switch back to Git.

I’ve often wondered what will come next after Git. I’m not saying this is that thing, but it’s cool to see people working on the problem.

Databases github.com

PRQL – a modern language for transforming data

PRQL (pronounced “Prequel”) aims to be “a simpler and more powerful SQL”

Like SQL, it’s readable, explicit and declarative. Unlike SQL, it forms a logical pipeline of transformations, and supports abstractions such as variables and functions. It can be used with any database that uses SQL, since it transpiles to SQL.

To get an idea on PRQL’s design, they provide this SQL statement as an example:

SELECT TOP 20
    title,
    country,
    AVG(salary) AS average_salary,
    SUM(salary) AS sum_salary,
    AVG(salary + payroll_tax) AS average_gross_salary,
    SUM(salary + payroll_tax) AS sum_gross_salary,
    AVG(salary + payroll_tax + benefits_cost) AS average_gross_cost,
    SUM(salary + payroll_tax + benefits_cost) AS sum_gross_cost,
    COUNT(*) as count
FROM employees
WHERE salary + payroll_tax + benefits_cost > 0 AND country = 'USA'
GROUP BY title, country
ORDER BY sum_gross_cost
HAVING count > 200

And then translate it to PRQL, which looks like:

from employees
filter country = "USA"                           # Each line transforms the previous result.
let gross_salary = salary + payroll_tax          # This _adds_ a column / variable.
let gross_cost   = gross_salary + benefits_cost  # Variables can use other variables.
filter gross_cost > 0
aggregate by:[title, country] [                  # `by` are the columns to group by.
    average salary,                              # These are the calcs to run on the groups.
    sum     salary,
    average gross_salary,
    sum     gross_salary,
    average gross_cost,
    sum     gross_cost,
    count,
]
sort sum_gross_cost                              # Uses the auto-generated column name.
filter count > 200
take 20

The New Stack Icon The New Stack

The case for Rust as the future of JavaScript infrastructure

Lee Robinson from Vercel/Next.js:

Rust is now replacing parts of the JavaScript web ecosystem like minification (Terser), transpilation (Babel), formatting (Prettier), bundling (webpack), linting (ESLint) and more. Let’s take a deep dive into why this trend is gaining popularity and wider adoption.

We just discussed this topic (and some apprehension about it) on JS Party last week. Definitely a trned worth brushing up on, if you haven’t already.

PostgreSQL github.com

An easy-to-use, zero-downtime schema migration tool for Postgres

Reshape… automatically handles complex migrations that would normally require downtime or manual multi-step changes. During a migration, Reshape ensures both the old and new schema are available at the same time, allowing you to gradually roll out your application.

Designed for Postgres 12+ and experimental for now. Do not use in production until it shapes up.

Git github.com

Dura is a background process that watches your Git repos

If you ever get into an “oh snap!” situation where you think you just lost days of work, checkout a dura branch and recover.

Without dura, you use Ctrl-Z in your editor to get back to a good state. That’s so 2021. Computers crash and Ctrl-Z only works on files independently. Dura snapshots changes across the entire repository as-you-go, so you can revert to “4 hours ago” instead of “hit Ctrl-Z like 40 times or whatever”. Finally, some sanity.

This sounds a lot like how Fossil works out of the box, except maybe even more paranoid because Fossil will propagate every commit whereas Dura propagates all changes even before they’re committed.

Linux lkml.org

Experimental Rust support lands in the Linux kernel

Check out the original RFC to find the genesis of this effort. Here’s the opening pitch:

We know there are huge costs and risks in introducing a new main language in the kernel. We risk dividing efforts and we increase the knowledge required to contribute to some parts of the kernel.

Most importantly, any new language introduced means any module written in that language will be way harder to replace later on if the support for the new language gets dropped.

Nevertheless, we believe that, even today, the advantages of using Rust outweighs the cost. We will explain why in the following sections.

Godspeed to everyone collaborating on what will surely be a massive, years-long undertaking.

Rust oxide.computer

An embedded OS all in Rust

Bryan Cantrill, announcing Hubris and Humility:

… we found ourselves increasingly forcing existing systems out of the comfort of their design centers, we wondered: was our assumption of using an existing system wrong? Should we in fact be exploring our own de novo operating system? In particular, our colleague Cliff Biffle, who had a ton of experience with both Rust and embedded systems, had a vision for what such a system might look like (namely, the system that he had always wanted for himself!). Cliff dove into a sketch of his ideas, giving the nascent system a name that felt perfectly apt: Hubris.

There’s some serious innovation going on at Oxide and I can’t wait to see what they do next.

  0:00 / 0:00