Converting a Rust struct to an enum doesn't always require a semver-major version bump, but it requires careful preparation. The struct must have no public fields (using accessor methods instead), and if it has no fields at all, it must have been marked `#[non_exhaustive]` from the start to prevent external code from using struct literal syntax. The post walks through each condition and explains how `cargo-semver-checks` (v0.16) can automatically detect violations, covering inherent methods, auto-traits, derived traits, and struct literal usage. Adding `#[non_exhaustive]` retroactively is itself a breaking change, so the attribute must be present before the conversion.

7m read timeFrom predr.ag
Post cover image
Table of contents
Implemented methods and traitsPublic fieldsSurprise! One more thing to considerConclusion