Trait BindTarget

Source
pub trait BindTarget: Clone {
    const IS_KEY: bool;
    const IS_POINTER: bool;
    const CLEARABLE: bool;

    // Required methods
    fn set_key(&mut self, key: Key, modifiers: Modifiers);
    fn set_pointer(&mut self, button: PointerButton, modifiers: Modifiers);
    fn clear(&mut self);
    fn format(&self) -> String;
    fn down(&self, ctx: &Context) -> bool;
    fn pressed(&self, ctx: &Context) -> bool;
    fn released(&self, ctx: &Context) -> bool;
}
Expand description

Type that can be used as a bind target

Required Associated Constants§

Source

const IS_KEY: bool

Can accept key bind?

Source

const IS_POINTER: bool

Can accept pointer bind?

Source

const CLEARABLE: bool

Can be cleared?

Required Methods§

Source

fn set_key(&mut self, key: Key, modifiers: Modifiers)

Sets new key bind

Source

fn set_pointer(&mut self, button: PointerButton, modifiers: Modifiers)

Sets new pointer bind

Source

fn clear(&mut self)

Clears the bind

Source

fn format(&self) -> String

Formats a bind to a string

Source

fn down(&self, ctx: &Context) -> bool

Is bind down?

Source

fn pressed(&self, ctx: &Context) -> bool

Was bind pressed this frame?

Source

fn released(&self, ctx: &Context) -> bool

Was bind released this frame?

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 BindTarget for Option<KeyOrPointer>

Source§

const IS_KEY: bool = true

Source§

const IS_POINTER: bool = true

Source§

const CLEARABLE: bool = true

Source§

fn set_key(&mut self, key: Key, _: Modifiers)

Source§

fn set_pointer(&mut self, button: PointerButton, _: Modifiers)

Source§

fn clear(&mut self)

Source§

fn format(&self) -> String

Source§

fn down(&self, ctx: &Context) -> bool

Source§

fn pressed(&self, ctx: &Context) -> bool

Source§

fn released(&self, ctx: &Context) -> bool

Source§

impl BindTarget for Option<PointerButton>

Source§

const IS_KEY: bool = false

Source§

const IS_POINTER: bool = true

Source§

const CLEARABLE: bool = false

Source§

fn set_key(&mut self, _: Key, _: Modifiers)

Source§

fn set_pointer(&mut self, button: PointerButton, _: Modifiers)

Source§

fn format(&self) -> String

Source§

fn clear(&mut self)

Source§

fn down(&self, ctx: &Context) -> bool

Source§

fn pressed(&self, ctx: &Context) -> bool

Source§

fn released(&self, ctx: &Context) -> bool

Source§

impl BindTarget for Option<Key>

Source§

const IS_KEY: bool = true

Source§

const IS_POINTER: bool = false

Source§

const CLEARABLE: bool = true

Source§

fn set_key(&mut self, key: Key, _: Modifiers)

Source§

fn set_pointer(&mut self, _: PointerButton, _: Modifiers)

Source§

fn format(&self) -> String

Source§

fn clear(&mut self)

Source§

fn down(&self, ctx: &Context) -> bool

Source§

fn pressed(&self, ctx: &Context) -> bool

Source§

fn released(&self, ctx: &Context) -> bool

Source§

impl BindTarget for PointerButton

Source§

const IS_KEY: bool = false

Source§

const IS_POINTER: bool = true

Source§

const CLEARABLE: bool = false

Source§

fn set_key(&mut self, _: Key, _: Modifiers)

Source§

fn set_pointer(&mut self, button: PointerButton, _: Modifiers)

Source§

fn clear(&mut self)

Source§

fn format(&self) -> String

Source§

fn down(&self, ctx: &Context) -> bool

Source§

fn pressed(&self, ctx: &Context) -> bool

Source§

fn released(&self, ctx: &Context) -> bool

Source§

impl BindTarget for Key

Source§

const IS_KEY: bool = true

Source§

const IS_POINTER: bool = false

Source§

const CLEARABLE: bool = false

Source§

fn set_key(&mut self, key: Key, _: Modifiers)

Source§

fn set_pointer(&mut self, _: PointerButton, _: Modifiers)

Source§

fn format(&self) -> String

Source§

fn clear(&mut self)

Source§

fn down(&self, ctx: &Context) -> bool

Source§

fn pressed(&self, ctx: &Context) -> bool

Source§

fn released(&self, ctx: &Context) -> bool

Source§

impl<B: BindTarget> BindTarget for (B, Modifiers)

Source§

const IS_KEY: bool = B::IS_KEY

Source§

const IS_POINTER: bool = B::IS_POINTER

Source§

const CLEARABLE: bool = false

Source§

fn set_key(&mut self, key: Key, modifiers: Modifiers)

Source§

fn set_pointer(&mut self, button: PointerButton, modifiers: Modifiers)

Source§

fn clear(&mut self)

Source§

fn format(&self) -> String

Source§

fn down(&self, ctx: &Context) -> bool

Source§

fn pressed(&self, ctx: &Context) -> bool

Source§

fn released(&self, ctx: &Context) -> bool

Source§

impl<B: BindTarget> BindTarget for Option<(B, Modifiers)>

Source§

const IS_KEY: bool = B::IS_KEY

Source§

const IS_POINTER: bool = B::IS_POINTER

Source§

const CLEARABLE: bool = true

Source§

fn set_key(&mut self, key: Key, modifiers: Modifiers)

Source§

fn set_pointer(&mut self, button: PointerButton, modifiers: Modifiers)

Source§

fn clear(&mut self)

Source§

fn format(&self) -> String

Source§

fn down(&self, ctx: &Context) -> bool

Source§

fn pressed(&self, ctx: &Context) -> bool

Source§

fn released(&self, ctx: &Context) -> bool

Implementors§