A Rust binding may depend on the SDK version, a component setting, and a feature of the actual chip.

If I say a Rust binding supports a new version of a C SDK, what should someone with an older board expect? The new version can know about the board without the board having every peripheral the SDK describes. A version number gets me to the right shelf. It doesn't tell me which parts are in the box.

That was the problem behind a change I worked on in esp-idf-sys, which exposes Espressif's C interfaces to Rust. I carried forward drinkcat's work and added changes in the review. What interested me was how to keep the bindings honest when a header moved, a component might be off, or one chip had a capability the next chip did not.

A version answers only one question.

When a new SDK changes the set of headers, a binding generator needs to know where an interface lives. The USB CDC console header in this change is a useful example. It had been pulled in through the older VFS grouping before version 6. The change ties the include to the console component when it's enabled, rather than assuming a sufficiently new SDK is enough.

That matters at the point a developer uses the binding. A missing or invalid declaration may otherwise look like a Rust problem, even when the real question is what the C SDK makes available in that configuration.

Name each condition where it matters.

  1. Find the header in the right release
  2. Check that the configuration includes the component
  3. Check the chip capability for target-specific interfaces

Individual headers have different conditions. The three questions aren't one blanket guard.

A component can exist without a particular peripheral.

The camera controller makes the distinction visible. The controller header is conditional on enabling its component. The CSI camera interface is separately guarded by a chip capability. Turning on the camera component doesn't make a chip grow a MIPI CSI interface. The JPEG paths give another example: encoding and decoding each have their own capability check.

I prefer these checks close to the header they protect. One broad condition at the top is shorter, but it can smuggle in the assumption that everything below it shares the same support boundary. That assumption tends to surface later as a broken build on a configuration the author didn't use.

A build matrix is a useful, bounded promise.

The pull request lists coverage from ESP-IDF v4.4.8 through v6.0, with explicit target exclusions. A build matrix makes those choices reviewable. A missing cell can mean the pairing is intentionally outside the check. That is a different statement from a green build and a different statement from a broken one.

The matrix checks compilation for the combinations it covers. It can't tell me whether a camera is wired correctly, what the device will do under load, or whether every board marketed with a given chip behaves the same way. Those need different evidence. I want the support statement to say where the build check stops.

The test I use for a compatibility claim is simple: could someone point to their own version, target, and configuration and tell which parts of that claim apply to them?

What I take from it

State support at the version, component, and chip boundary. A green build is evidence for that combination, not a hardware test.

Code and further reading

Read the illustrated essay on mh0pe.github.io