pub enum Modifier {
Alt,
Control,
Shift,
Meta,
LeftAlt,
RightAlt,
LeftControl,
RightControl,
LeftShift,
RightShift,
LeftMeta,
RightMeta,
}Expand description
Keyboard modifier key enumeration
Variants§
Alt
Alt key (generic)
Control
Ctrl key (generic)
Shift
Shift key (generic)
Meta
System key (Windows key/Command key)
LeftAlt
Left Alt key
RightAlt
Right Alt key
LeftControl
Left Ctrl key
RightControl
Right Ctrl key
LeftShift
Left Shift key
RightShift
Right Shift key
LeftMeta
Left system key
RightMeta
Right system key
Implementations§
Source§impl Modifier
impl Modifier
Sourcepub fn as_str(&self) -> &'static str
pub fn as_str(&self) -> &'static str
Get the string representation of the modifier
Examples found in repository?
examples/game_input_system.rs (line 134)
124 fn list_bindings(&self) {
125 println!("\n普通键绑定:");
126 let mut keys: Vec<_> = self.key_bindings.iter().collect();
127 keys.sort_by_key(|(key, _)| key.as_str());
128 for (key, action) in keys {
129 println!(" {:15} -> {:?}", key, action);
130 }
131
132 println!("\n修饰键绑定:");
133 let mut modifiers: Vec<_> = self.modifier_bindings.iter().collect();
134 modifiers.sort_by_key(|(modifier, _)| modifier.as_str());
135 for (modifier, action) in modifiers {
136 println!(" {:15} -> {:?}", modifier, action);
137 }
138 }Trait Implementations§
Source§impl KeyCodeMapper for Modifier
impl KeyCodeMapper for Modifier
impl Copy for Modifier
impl Eq for Modifier
impl StructuralPartialEq for Modifier
Auto Trait Implementations§
impl Freeze for Modifier
impl RefUnwindSafe for Modifier
impl Send for Modifier
impl Sync for Modifier
impl Unpin for Modifier
impl UnwindSafe for Modifier
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more