跳到主要内容

EventType

搜索

枚举EventType 

Source
pub enum EventType {
    KeyPress(Key),
    KeyRelease(Key),
    ButtonPress(Button),
    ButtonRelease(Button),
    MouseMove {
        x: f64,
        y: f64,
    },
    Wheel {
        delta_x: i64,
        delta_y: i64,
    },
}
展开描述

为了兼容不同的操作系统,当前的 EventType 选项是混合搭配的,以涵盖所有可能的事件。

变体§

§

KeyPress(Key)

键名对应于标准的 QWERTY 布局,并不直接对应用户实际输入的字母——要支持后者需要添加额外的布局逻辑。

§

KeyRelease(Key)

§

ButtonPress(Button)

鼠标按钮

§

ButtonRelease(Button)

§

MouseMove

以像素为单位。EventType::MouseMove{x: 0, y: 0} 对应左上角,x 向下增加,y 向右增加。

字段

§

Wheel

delta_y 表示垂直滚动,delta_x 表示水平滚动。 正值对应向上或向右滚动,负值 对应向下或向左滚动。

字段

§delta_x: i64
§delta_y: i64

Trait 实现§

Source§

impl Clone for EventType

Source§

fn clone(&self) -> EventType

返回该值的一个副本。阅读更多
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

执行从 source. 阅读更多
Source§

impl Debug for EventType

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

使用给定的格式化器格式化该值。阅读更多
Source§

impl PartialEq for EventType

Source§

fn eq(&self, other: &EventType) -> bool

测试 selfother 的值是否相等,并由 == 使用。
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

测试 !=。默认实现几乎总是足够的,除非有非常充分的理由,否则不应被重写。
Source§

impl Copy for EventType

Source§

impl StructuralPartialEq for EventType

自动 Trait 实现§

通用实现§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. 阅读更多
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

对拥有的值进行不可变借用。阅读更多
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

对拥有的值进行可变借用。阅读更多
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬这是一个仅在 nightly 可见的实验性 API。(clone_to_uninit)
执行从 self to dest. 阅读更多
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

原样返回参数。

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

调用 U::from(self)

That is, this conversion is whatever the implementation of From<T> for U 的实现自行决定。

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

获取所有权后得到的类型。
Source§

fn to_owned(&self) -> T

从借用的数据创建拥有的数据,通常通过克隆完成。阅读更多
Source§

fn clone_into(&self, target: &mut T)

使用借用的数据替换拥有的数据,通常通过克隆完成。阅读更多
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

转换失败时返回的类型。
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

执行转换。
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

转换失败时返回的类型。
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

执行转换。