Rusty Buffers

Rust’s ownership system makes it easy and safe to create a zero-copy parser that takes a slice of bytes as input and outputs some structure containing references to the original input. Rust ensures that such references exist only while the underlying slice cannot be mutated. As a concrete example say we have a &[u8] containing “3foo3bar3baz4quux” and want to parse it into vec![“foo”, “bar”, “baz”, “quux”]. This is easily accomplished by defining a couple of nom parser combinators:
Continue reading

Rust and Go

A new era of statically typed, natively compiled, programming languages has arrived sweeping aside the old choice between performance and productivity while also eliminating runtime dependencies on an interpreter or VM. Two of the top contenders are Rust and Go, how does a programmer choose between them? For some applications the choice is simple. Go’s lightweight concurrency and excellent networking libraries make implementing high-performance network clients and servers a joy.
Continue reading