Skip to main content

Module profile

Module profile 

Source
Expand description

Build profiles.

A profile is a named preset of build settings that affect how Cabin compiles a package — debug information, optimization level, assertions. Two profiles are built in:

  • dev — local development. Debug info on, no optimization, assertions on.
  • release — optimized builds. Debug info off, full optimization, assertions off.

Manifests may declare additional [profile.<name>] tables to override the built-in defaults or to add custom presets that inherit from one of the built-ins. Resolution merges parents-first and is fully typed; the rest of Cabin (cabin-build, cabin, cabin-package) consumes a ResolvedProfile directly and never sees raw TOML.

This module owns the model and the resolver. Manifest parsing lives in cabin-manifest; CLI flag handling lives in cabin.

Structs§

InvalidProfileName
cabin.toml’s public grammar limits which characters profile names may contain. The constructor surfaces this error type so callers (CLI, manifest parser) can format a clear diagnostic without duplicating the rule.
ProfileDefaults
Concrete defaults for one profile. Used to seed inheritance before any manifest overrides apply.
ProfileDefinition
One [profile.<name>] declaration as it appeared in cabin.toml, after manifest-level validation but before inheritance resolution. Every field except name is Option so the resolver can tell “user did not set this” from “user set this to a value”.
ProfileName
Validated profile name.
ProfileSelection
User-facing profile selection (one CLI invocation picks at most one profile). The resolver expands this into a full ResolvedProfile against a definition table.
ResolvedProfile
Fully resolved profile.

Enums§

BuiltinProfile
One of the two profiles Cabin always provides without any manifest declaration.
OptLevel
Semantic optimization level. Mirrors the GCC / Clang -O family without exposing raw flag strings at the manifest layer; each value maps to a fixed GCC / Clang-style -O flag (see OptLevel::as_flag) that the build planner appends verbatim. There is no per-toolchain flag translation today.
ProfileResolutionError
Errors produced by resolve_profile.
ProfileSource
Where a ResolvedProfile originated.

Functions§

available_profile_names
Enumerate every profile name reachable for a given definition set: the two built-ins plus every manifest-declared name. Useful for cabin metadata --profile-list-style consumers without forcing each caller to special-case built-ins.
resolve_profile
Resolve a ProfileSelection against a set of manifest ProfileDefinitions.