Trait winput::Keylike[][src]

pub trait Keylike: Copy {
    fn produce_input(self, action: Action) -> Input;
}

A trait for objects that can be used as keys. For example a Vk or a char can be used as a key.

Example

use winput::Vk;

// Print `A`
winput::press(Vk::Shift);
winput::send(Vk::A);
winput::release(Vk::Shift);

// Do the same with one line
winput::send('A');

Required methods

fn produce_input(self, action: Action) -> Input[src]

Produces an Input that causes the given action to be taken on self.

Panics

This function panics if self was not a valid key. For example, any char that is above 0x0000ffff cannot be turned into an Input.

Example

use winput::{Keylike, Action};

let input = 'A'.produce_input(Action::Press);
winput::send_inputs(&[input]);
Loading content...

Implementations on Foreign Types

impl Keylike for char[src]

Loading content...

Implementors

impl Keylike for Button[src]

impl Keylike for Vk[src]

Loading content...