pub trait Bind: Clone {
// Required methods
fn set(
&mut self,
keyboard: Option<KeyboardShortcut>,
pointer: Option<PointerButton>,
);
fn format(&self, names: &ModifierNames<'_>, is_mac: bool) -> String;
fn pressed(&self, input: &mut InputState) -> bool;
}
Expand description
Required Methods§
Sourcefn set(
&mut self,
keyboard: Option<KeyboardShortcut>,
pointer: Option<PointerButton>,
)
fn set( &mut self, keyboard: Option<KeyboardShortcut>, pointer: Option<PointerButton>, )
Set the keybind with a given KeyboardShortcut and/or PointerButton.
§Arguments
keyboard
- The keyboard shortcut to set (KeyboardShortcut), or None.pointer
- The pointer button to set (PointerButton), or None.
Sourcefn format(&self, names: &ModifierNames<'_>, is_mac: bool) -> String
fn format(&self, names: &ModifierNames<'_>, is_mac: bool) -> String
Format the current keybind as a String.
§Arguments
names
- The ModifierNames to use.is_mac
- Whether to use MacOS symbols.
§Returns
The formatted keybind as a String.
Sourcefn pressed(&self, input: &mut InputState) -> bool
fn pressed(&self, input: &mut InputState) -> bool
Check if the keybind is pressed.
§Arguments
input
- The InputState to check with.
§Returns
Whether the keybind is pressed.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementations on Foreign Types§
Source§impl Bind for Option<PointerButton>
impl Bind for Option<PointerButton>
fn set( &mut self, _keyboard: Option<KeyboardShortcut>, pointer: Option<PointerButton>, )
fn format(&self, _names: &ModifierNames<'_>, _is_mac: bool) -> String
fn pressed(&self, input: &mut InputState) -> bool
Source§impl Bind for Option<Key>
impl Bind for Option<Key>
fn set( &mut self, keyboard: Option<KeyboardShortcut>, _pointer: Option<PointerButton>, )
fn format(&self, _names: &ModifierNames<'_>, _is_mac: bool) -> String
fn pressed(&self, input: &mut InputState) -> bool
Source§impl Bind for Option<KeyboardShortcut>
impl Bind for Option<KeyboardShortcut>
fn set( &mut self, keyboard: Option<KeyboardShortcut>, _pointer: Option<PointerButton>, )
fn format(&self, names: &ModifierNames<'_>, is_mac: bool) -> String
fn pressed(&self, input: &mut InputState) -> bool
Source§impl Bind for PointerButton
A Bind implementation for egui’s PointerButton. Ignores keys and modifiers.
impl Bind for PointerButton
A Bind implementation for egui’s PointerButton. Ignores keys and modifiers.
fn set( &mut self, _keyboard: Option<KeyboardShortcut>, pointer: Option<PointerButton>, )
fn format(&self, _names: &ModifierNames<'_>, _is_mac: bool) -> String
fn pressed(&self, input: &mut InputState) -> bool
Source§impl Bind for Key
impl Bind for Key
fn set( &mut self, keyboard: Option<KeyboardShortcut>, _pointer: Option<PointerButton>, )
fn format(&self, _names: &ModifierNames<'_>, _is_mac: bool) -> String
fn pressed(&self, input: &mut InputState) -> bool
Source§impl Bind for KeyboardShortcut
A Bind implementation for egui’s KeyboardShortcut.
impl Bind for KeyboardShortcut
A Bind implementation for egui’s KeyboardShortcut.