pub enum Event {
Show 15 variants WindowResize, FocusLost, Refresh, Char(char), CtrlChar(char), AltChar(char), Key(Key), Shift(Key), Alt(Key), AltShift(Key), Ctrl(Key), CtrlShift(Key), CtrlAlt(Key), Mouse { offset: XY<usize>, position: XY<usize>, event: MouseEvent, }, Unknown(Vec<u8, Global>), // some variants omitted
}
Expand description

Represents an event as seen by the application.

Variants

WindowResize

Event fired when the window is resized.

FocusLost

Event fired when the view is about to lose focus.

Refresh

Event fired regularly when a auto-refresh is set.

Char(char)

A character was entered (includes numbers, punctuation, …).

CtrlChar(char)

A character was entered with the Ctrl key pressed.

AltChar(char)

A character was entered with the Alt key pressed.

Key(Key)

A non-character key was pressed.

Shift(Key)

A non-character key was pressed with the Shift key pressed.

Alt(Key)

A non-character key was pressed with the Alt key pressed.

AltShift(Key)

A non-character key was pressed with the Shift and Alt keys pressed.

Ctrl(Key)

A non-character key was pressed with the Ctrl key pressed.

CtrlShift(Key)

A non-character key was pressed with the Ctrl and Shift keys pressed.

CtrlAlt(Key)

A non-character key was pressed with the Ctrl and Alt keys pressed.

Mouse

Fields

offset: XY<usize>

Position of the top-left corner of the view receiving this event.

position: XY<usize>

Position of the mouse when this event was fired.

event: MouseEvent

The mouse event itself.

A mouse event was sent.

Unknown(Vec<u8, Global>)

An unknown event was received.

Implementations

Returns the position of the mouse, if self is a mouse event.

Returns a mutable reference to the position of the mouse/

Returns None if self is not a mouse event.

Update self with the given offset.

If self is a mouse event, adds top_left to its offset. Otherwise, do nothing.

Returns a cloned, relativized event.

If self is a mouse event, adds top_left to its offset. Otherwise, returns a simple clone.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Calls the given closure and return the result. Read more

Calls the given closure on self.

Calls the given closure on self.

Calls the given closure if condition == true.