Skip to main content

flagset


Nathaniel
Okay, moving on, we'll talk about flagset. flagset is I don't know if we have any actual direct dependencies of flagset, but I have added flagset as a dependency to the Rust crypto project. And so you may be familiar with the bitflags crate or the enumflags crate. And both of those crates had significant downsides, which I talked about in the existing implementations. And the, we basically implemented a new implementation of this, which doesn't have all the downsides. For example, we don't have procedural macros, which requires additional dependencies, and then increases your compile time. And we just do this instead of with regular macros. And on the other hand, we don't have problems like enumflags, for example, does not allow you to describe the size of the flags in a way that's binary compatible, particularly across aliasing. So like we support that ability. They're basically a bunch of hardware level features. The crate itself is fairly ergonomic to use, it's very well tested. And the way we're using it in the Rust crypto project is that we are any of the flags that are described in asn1. We have blank implementations of encoding and decoding from the asn1 values into flag set values. And then we have an ergonomic API to test bit flags basically. So this crate is actually used a variety of places. The crate is actually one of the first crates I ever wrote. So it's quite old. It's three or four years old, I think at this point.