May 5, 2017·5 min read·engineeringrustlibrariesapicommunity

The Libz Blitz reviews the crates beneath the frameworks

Rust launches coordinated reviews of foundational crates, with API guidelines and a problem-oriented cookbook. The process seeks standard-library consistency while leaving packages free to evolve independently.

A framework cannot offer a stable public interface if the types it exposes come from dependencies that still change incompatibly. This is one reason the Rust library team is starting its coordinated review effort with smaller foundational crates. The Libz Blitz aims to improve the packages on which larger libraries depend before asking those larger libraries to settle their own designs.

The May 5 announcement by Brian Anderson, David Tolnay, and Aaron Turon describes reviews, follow-up issues, and documentation work. It connects the effort to the 2017 roadmap, whose goals include easier access to high-quality crates and libraries ready for stable use in essential tasks. The work is an ecosystem initiative, not a plan to move every useful package into std.

I like the possibility of applying systems-level guarantees through libraries with ordinary, consistent interfaces. The compiler can check the ownership rules expressed by an API, but the library author still chooses whether that API communicates its costs and invariants clearly. Reviewing those choices is substantive engineering work.

A small standard library creates a discovery problem

The announcement describes the attraction of a broad standard library. Users know where to look, interfaces can follow common conventions, and maintenance has an identifiable owner. It also describes the cost of coupling a library to the language release and compatibility policy. Breaking a standard-library interface becomes much harder than changing an independently versioned crate.

Rust is still learning how ownership-based APIs should be designed. Putting every developing design under the standard compatibility promise would make those lessons expensive to apply. The initiative seeks some of the consistency associated with a standard library while retaining independent package evolution.

Cargo supplies the dependency mechanism, but dependency installation alone cannot establish quality or explain which crate to choose. A package can be easy to add and still have incomplete documentation or surprising interface conventions. The Libz Blitz therefore combines code review with guidance and discovery work.

The announcement says this is mainly a matter of improving and consolidating existing crates. It does not present the ecosystem as empty. Some foundational packages are widely used and close to functional completeness, while others need design work before a stable API commitment would be appropriate.

Public dependencies determine compatibility

The post gives a hypothetical database library returning a type from an early version of uuid. If another library uses a newer incompatible uuid, the supposedly stable interface can become difficult to compose with it. A public dependency participates in the contract that users see.

That example explains why the project is not beginning with prominent frameworks such as Tokio, Diesel, or Rocket. Those projects are still developing under their own leadership. Pressuring them to declare stability would constrain experimentation without resolving the lower-level compatibility issues.

Foundational crates also affect many consumers at once. Improving compression, random-number generation, or byte-order handling can remove recurring deficiencies across larger libraries. The review can focus on a limited interface while its effects reach more than one framework.

The announcement does not impose a universal date for every crate to become stable. It proposes a process for identifying the work separating a selected crate from that point. The difference matters because a version number by itself cannot repair an unresolved design or an unstable public dependency.

The review ends in actionable work

A few crates are evaluated concurrently in a shared forum. Every two weeks, a library-team meeting examines one evaluation with the author involved. The results become tracking issues so other contributors can help implement the changes.

That sequence avoids treating review as a general endorsement. A useful evaluation identifies missing behavior, inconsistent API choices, or incomplete explanations. An issue turns an observation into a specific piece of work, and its scope can be small enough for someone who is not a library designer to contribute.

The announcement describes roles for leading an evaluation, checking a crate against guidelines, writing documentation, and implementing fixes. The lead carries organizational responsibilities as well as technical ones. Keeping a review moving and filing discrete issues are necessary if the feedback is to produce changes.

Byteorder provides an early example. The announcement lists resolved issues concerning panic and error documentation, examples, and package metadata, alongside API details. Those tasks are useful even in a small crate. A narrow purpose does not automatically make a library complete or easy to discover.

Guidelines capture decisions that should repeat

The proposed API guidelines draw on experience maintaining the standard library. The announcement names clear performance characteristics and ownership that encapsulates invariants as principles. It also mentions naming conventions such as as and into, where consistent spelling helps users predict an operation they have not seen before.

This is especially useful in an ecosystem with independently maintained packages. A programmer should not have to learn a new naming convention for the same kind of conversion in every crate. Shared conventions reduce the amount of local explanation needed while leaving room for a crate to document an unusual requirement.

The guidelines are explicitly early work. Review is intended to refine them as well as apply them. A crate may expose a design question the existing rules do not answer, and the discussion can produce guidance for other authors. That keeps the document connected to actual interfaces instead of treating its first draft as complete.

I favor this relationship between examples and rules. A convention is easier to assess when it solves a visible problem in an existing library. The review can preserve that reasoning so the next author understands when the convention applies.

The cookbook starts with a task

Reference documentation usually begins with types and functions. The new cookbook is intended to begin with a problem a programmer wants to solve and provide a concrete example using suitable crates. That addresses a different obstacle from an undocumented parameter.

A user may understand every item in a reference and still not know which library to select. A problem-oriented example supplies both a starting dependency and a path through its interface. The announcement makes writing such examples part of the work on each reviewed crate.

This also gives the quality effort an outward-facing result. Improvements inside a package matter more when users can find the package and see how it addresses their task. The immediate initiative connects those examples to reviews and follow-up issues, so discovery, documentation, and implementation can advance through the same selected set of foundational crates.