Expand description
Transient mode — grouped action menus within the picker.
A transient presents groups of action items with single-key selection, toggleable flags, argument inputs, and a live command preview. Magit is the first consumer (dispatch menus, branch menus, stash menus), but which-key key hints, command palette drilldown, and future plugin transients all reuse the same mechanism.
See docs/dev/architecture/magit.md §8.
Structs§
- Transient
ArgSource - MG.53.e: where a picker-backed
TransientItemKind::Argumentgets its candidate list. - Transient
Context - Registry of named transient builders, populated at boot by each
owning mode crate (magit registers
magit-dispatch/magit-file-dispatch; per the module doc, which-key / command palette / future plugin transients are meant to reuse the same mechanism).Effect::OpenTransient { source }carries only the name — resolving it to an actualTransientSpec(which can’t cross intolattice-grammar’sEffectenum directly, sinceTransientSpeclives downstream of it) happens here, at the renderer’s effect-handling site. MirrorsPickerRegistry’s named-source shape, simplified: transients have no candidate generator or arg-schema concept, just a name and a builder. - Transient
Group - A named group of transient items.
- Transient
Item - A single entry in a transient group.
- Transient
Source Registry - Transient
Spec - Specification for a transient menu — the complete layout.
Stored behind an
Arcin thePickerstruct so clone is a ref-count bump; thepreviewboxed closure stays alive across clones.
Enums§
- KeyResolution
- What
TransientSpec::resolve_keymade of the keys typed so far. - Transient
Build - What
TransientSourceRegistry::buildanswers with. - Transient
Item Kind - The kind of a transient item — determines its interaction.
- Transient
Value - A single value in the transient state (flag or argument).
Functions§
- confirm_
transient_ spec - Build a simple y/n confirmation transient spec.
promptis the title shown at the top;yes_command_idis the action fired when the user pressesy. - transient_
initial_ state - Build initial state from a spec — flags get their defaults, arguments get their defaults (or empty string).
Type Aliases§
- Transient
Build Future - A menu build that could not answer synchronously — the shape a
guest-backed builder returns. Mirrors
PickerInitResult::Future:'static + Send, so the host can move it onto its own runtime and seat the menu when it lands. - Transient
Source Registry Handle - Service handle registered via
SubsystemBoot::register_service— sameArc<X>register-and-lookup convention every other service handle in this codebase uses. - Transient
State - Accumulated state for an open transient: flag values and argument
values. Keyed by the
namefield fromTransientItemKind::FlagandTransientItemKind::Argumentitems.