Struct KeyRegistration
#[non_exhaustive]pub struct KeyRegistration {
pub id: String,
pub label: String,
pub key: String,
pub modifiers: ClientModifiers,
pub category: String,
pub context: KeyConflictContext,
}Expand description
A key a mod registers through Registrar::register_key_mapping: it is listed under the mod’s name on
Options > Controls, and the player’s binding and reset are kept by mod id in horizon-mods.txt.
Its default is key with modifiers held; shift, control and alt are bound, super is not.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.id: StringThe key’s id, unique within its mod (zoom).
label: StringThe translation key for the label Controls shows.
key: StringThe default key (key.keyboard.z).
modifiers: ClientModifiersThe default modifiers, in GLFW’s input-event encoding (shift 1, control 2, alt 4).
category: StringThe category translation key within its mod’s heading; empty for none.
context: KeyConflictContextWhen this mapping can conflict with another binding.
Implementations§
§impl KeyRegistration
impl KeyRegistration
pub fn context(self, context: KeyConflictContext) -> KeyRegistration
pub fn context(self, context: KeyConflictContext) -> KeyRegistration
Sets the conflict context.
pub fn new(id: &str, key: &str) -> KeyRegistration
pub fn new(id: &str, key: &str) -> KeyRegistration
Key id of the registering mod, bound to key with no modifiers and labelled id.
pub fn label(self, label: &str) -> KeyRegistration
pub fn label(self, label: &str) -> KeyRegistration
Sets the label translation key Controls shows.
pub fn modifiers(self, modifiers: ClientModifiers) -> KeyRegistration
pub fn modifiers(self, modifiers: ClientModifiers) -> KeyRegistration
Sets the modifiers the default binding holds.
pub fn category(self, category: &str) -> KeyRegistration
pub fn category(self, category: &str) -> KeyRegistration
Sets the category translation key the binding is listed under.
Trait Implementations§
§impl Clone for KeyRegistration
impl Clone for KeyRegistration
§fn clone(&self) -> KeyRegistration
fn clone(&self) -> KeyRegistration
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more