Skip to main content

Module binding_text

Module binding_text 

Source
Expand description

A Binding’s stable text form, both ways — what a player’s saved rebinds are written in.

Binding’s Display prints it and its FromStr reads it back, so a binding round-trips through a settings file whatever holds the file. Like KeyCode::as_str, which every key here is spelled with, it is a serialization format, not a display string: a rebind menu shows the keysym or the pad glyph, never this.

BindingText
KeyKeyR
ChordAlt+KeyR (Shift, Control, Alt, Super)
ScrollChordControlLeft+Scroll
MouseButtonMouse:Left, Mouse:Back, Mouse:9
ButtonChordAlt+Mouse:Right (a Chord’s modifier, a MouseButton’s button)
MouseMotionMouseMotion
MouseScrollMouseScroll
PointerPositionPointer:X, Pointer:Y
KeyAxisKeyAxis:KeyS,KeyW (negative, positive)
WasdWasd:KeyW,KeyS,KeyA,KeyD (up, down, left, right)
VirtualVirtual: and the control’s id, verbatim
PadButtonPad:South, by PadButton variant
PadChordPad:LeftShoulder+South (modifier, then button)
PadDpadPad:Dpad
PadStickPadStick:Left>0.2 (the dead zone)
PadTriggerPadTrigger:Right>0.25 (the threshold)

A dead zone or threshold prints as Rust’s shortest f32 form, which reads back to the same bits. Parsing checks the spelling only: a threshold outside 0.0..1.0 parses, and ActionMap::rebind refuses it as it refuses one built in code. A name this build does not know is a BindingParseError, never a panic, so a file written by a newer build costs the one binding and not the load.

Structs§

BindingParseError
Why a string is not a Binding’s text form — see the module docs.