Skip to content

Versioning

How CPUI’s version numbers change, which changes count as breaking, and how APIs are deprecated. Every change is recorded in the changelog.

This policy applies from version 0.1.0, the first release.

Versions are written 0.minor.patch and follow Cargo’s convention for 0.x versions:

Upgrade Example Meaning
Patch 0.3.1 → 0.3.2 Compatible: your code compiles unchanged and behaves the same
Minor 0.3.2 → 0.4.0 May be breaking: read the changelog entries marked Breaking first

With the dependency cpui = "0.3", Cargo upgrades only within 0.3.x.

cpui and cpui-render share one version number and are released together.

The policy covers every item exported from the root of cpui:

  • the application layer: App, Ui, the widgets, Style, Theme;
  • the host layer: Context, Input, FrameOutput, Offscreen;
  • the renderer types that cpui exports: Color, Rect, Frame and others.

Minimum system versions: macOS 13, Windows 10, Linux (glibc 2.28), iOS 16, Android 8 (API 26).

The following are not covered and may change in any release:

  • Items hidden from the documentation: cpui::doctest, Offscreen::with_threads, Offscreen::with_buffers.
  • Other items that are reachable only through a direct dependency on cpui-render.
  • The development tools under tools/.
  • The content of the CPUI_TRACE log and the Debug output of any type.

Breaking: released only in a minor version

Section titled “Breaking: released only in a minor version”
  • Removing or renaming a public item.
  • Changing a function’s parameters, return type or generic bounds.
  • Adding a method without a default implementation to App, Widget or Length.
  • Adding a variant to an enum that is not #[non_exhaustive]. Adding a field to a struct that can be written out in full, unless it is listed under types that keep growing.
  • Changing documented behavior so that correct code gets a different result. Examples: how widget identities are derived, what the fields of an interaction result mean, how sizing rules divide space.
  • Raising the minimum Rust version (now 1.89) or a minimum system version.
  • Upgrading, across a breaking version, a dependency that appears in the public API. There are two: accesskit (the return type of Context::accessibility) and winit (the argument of run on Android).

Compatible: may be released in a patch version

Section titled “Compatible: may be released in a patch version”
  • New functions, methods, types and widgets; new trait methods with default implementations.
  • New fields or variants on #[non_exhaustive] types, and new fields on the types listed below.
  • Bug fixes, even when existing code relies on the incorrect behavior. The changelog describes such fixes.
  • Changes in appearance: the token values of the built-in themes, the default sizes and spacing of widgets, and the rendered pixels. Tests that compare screenshots pixel by pixel may need updating. These changes are listed under “Changed”.
  • Changes in speed and memory use. Exceeding a budget is treated as a bug.
  • New deprecations.

These types have repeatedly gained fields or variants and will continue to do so:

Types How to use them
Key, CursorIcon, FontError, FontKind, FontSpec, GenericFamily, Stroke, FileDialogKind, IconName #[non_exhaustive]: a match needs a _ => arm
Response, TableResponse, FrameOutput, Input, FileDialog, FileFilter, Font, FontSet, FontStack, FontWeights, Metrics #[non_exhaustive]: read and write fields, but do not construct them by listing every field; create Input with Input::default(), FileDialog with FileDialog::open_file() and its siblings, Font with Font::new, FontSet with FontSet::default() and FontStack with FontStack::proportional or monospaced
Theme, Style, Options Not marked, so that Theme { accent, ..Theme::light() } keeps working; end the literal with ..Theme::light(), ..Style::default() or ..Options::default(), or use the chained methods

Code that lists every field of Theme, Style or Options without a trailing .. stops compiling when a field is added. This is not considered a breaking change.

Where possible, an API that is renamed or replaced is deprecated first and removed later, so that you can upgrade in two steps:

  1. The new API is added. The old one remains, marked #[deprecated] with the version of the deprecation and the replacement. Where possible, the old API calls the new one.
  2. After a release has carried the deprecation, the old API is removed in the next minor version at the earliest. An item deprecated in 0.3.0 or 0.3.2 is removed in 0.4.0 at the earliest.
pub struct Offscreen;
impl Offscreen {
/// The number of pixels in the latest frame.
pub fn snapshot(&self) -> usize {
0
}
/// The number of pixels in the latest frame.
#[deprecated(since = "0.3.0", note = "use `snapshot` instead")]
pub fn image(&self) -> usize {
self.snapshot()
}
}
  • since is the first version that carries the deprecation; note names the replacement.
  • A deprecated item keeps its documentation, whose first line names the replacement.
  • The framework, the examples and the documentation no longer use the deprecated item.
  • Some changes cannot coexist with the old API, such as changed parameters or a new required trait method. These skip deprecation: they are released in a minor version, and the changelog describes the migration.

The changelog has a section per version, divided into Added, Changed, Deprecated, Removed and Fixed.

  • An entry that starts with Breaking describes the migration: the old usage and the new usage, one line each.
  • A deprecation names the replacement and the earliest version that removes the old API.