Andrew Gallant's Blog on Andrew Gallant's Blog

https://blog.burntsushi.net/ (RSS)
visit blog
Regex engine internals as a library
5 Jul 2023 | original ↗

Over the last several years, I’ve rewritten Rust’s regex crate to enable better internal composition, and to make it easier to add optimizations while maintaining correctness. In the course of this rewrite I created a new crate, regex-automata, which exposes much of the regex crate internals as their own APIs for others to use. To my knowledge,...

A byte string library for Rust
7 Sept 2022 | original ↗

bstr is a byte string library for Rust and its 1.0 version has just been released! It provides string oriented operations on arbitrary sequences of bytes, but is most useful when those bytes are UTF-8. In other words, it provides a string type that is UTF-8 by convention, where as Rust’s built-in string types are guaranteed to be UTF-8. This blog...

Using unwrap() in Rust is Okay
8 Aug 2022 | original ↗

One day before Rust 1.0 was released, I published a blog post covering the fundamentals of error handling. A particularly important but small section buried in the middle of the article is named “unwrapping isn’t evil”. That section briefly described that, broadly speaking, using unwrap() is okay if it’s in test/example code or when panicking...

Archlinux on the System76 Darter Pro
27 Jan 2020 | original ↗

This is a quick post reviewing my Archlinux setup on a System76 Darter Pro (model: darp6) with Coreboot, along with some thoughts about the laptop in general. This is my first laptop upgrade since I purchased a ThinkPad T430 in July 2012 Target audience: Archlinux users looking for a compatible Linux laptop.

My FOSS Story
19 Jan 2020 | original ↗

I’d like to break from my normal tradition of focusing almost strictly on technical content and share a bit of my own personal relationship with Free and Open Source Software (FOSS). While everyone is different, my hope is that sharing my perspective will help build understanding, empathy and trust. This is not meant to be a direct response to...

Rust and CSV parsing
23 May 2017 | original ↗

With csv 1.0 just released, the time is ripe for a tutorial on how to read and write CSV data in Rust. This tutorial is targeted toward beginning Rust programmers, and is therefore full of examples and spends some time on basic concepts. Experienced Rust programmers may find parts of this useful, but would probably be happier with a quick skim....

ripgrep is faster than {grep, ag, git grep, ucg, pt, sift}
23 Sept 2016 | original ↗

In this article I will introduce a new command line search tool, ripgrep, that combines the usability of The Silver Searcher (an ack clone) with the raw performance of GNU grep. ripgrep is fast, cross platform (with binaries available for Linux, Mac and Windows) and written in Rust. ripgrep is available on Github. We will attempt to do the...

Index 1,600,000,000 Keys with Automata and Rust
12 Nov 2015 | original ↗

It turns out that finite state machines are useful for things other than expressing computation. Finite state machines can also be used to compactly represent ordered sets or maps of strings that can be searched very quickly. In this article, I will teach you about finite state machines as a data structure for representing ordered sets and maps....

Error Handling in Rust
14 May 2015 | original ↗

Like most programming languages, Rust encourages the programmer to handle errors in a particular way. Generally speaking, error handling is divided into two broad categories: exceptions and return values. Rust opts for return values. In this article, I intend to provide a comprehensive treatment of how to deal with errors in Rust. More than that,...

Syntax extensions and regular expressions for Rust
21 Apr 2014 | original ↗

WARNING: 2018-04-12: The code snippets for this post are no longer available. This is just as well anyway, since they all depended on an unstable internal compiler interface, which hasn’t existed for years. A few weeks ago, I set out to add regular expressions to the Rust distribution with an implementation and feature set heavily inspired by...

Writing type parametric functions in Go
6 Apr 2013 | original ↗

Go’s only method of compile time safe polymorphism is structural subtyping, and this article will do nothing to change that. Instead, I’m going to present a package ty with facilities to write type parametric functions in Go that maintain run time type safety, while also being convenient for the caller to use.

Introducing NFLGame: Programmatic access to live NFL game statistics
30 Aug 2012 | original ↗

As a programmer and a fantasy football addict, I am embarassed by the means through which we must expend ourselves to get data in a machine readable form. This lack of open source software cripples the community with sub-standard tools, and most importantly, detracts from some really cool and fun things that could be done with easily available...

Running Archlinux on the Lenovo Thinkpad T430
1 Jul 2012 | original ↗

In sum, Archlinux is working beautifully. What follows is a rough run down of my notes while installing, configuring, tuning and using Archlinux on the Lenovo Thinkpad T430.

Daemonizing Go Programs (with a BSD-style rc.d example)
28 Apr 2012 | original ↗

Go, by its very nature, is multithreaded. This makes a traditional approach of daemonizing Go programs by forking a bit difficult. To get around this, you could try something as simple as backgrounding your Go program and instructing it to ignore the HUP signal:

Adding Thread Safety to the X Go Binding
22 Apr 2012 | original ↗

The X Go Binding (XGB) is a low level library that provides an API to interact with running X servers. One can only communicate with an X server by sending data over a network connection; protocol requests, replies and errors need to be perfectly constructed down to the last byte. Xlib did precisely this, and then some. As a result, Xlib became...

↑ these items are from RSS. Visit the blog itself at https://blog.burntsushi.net/ to find other articles and to appreciate the author's digital home.