Enum piston_window::Event
[−]pub enum Event {
Input(Input, Option<u32>),
Loop(Loop),
Custom(EventId, Arc<dyn Any + Send + Sync + 'static>, Option<u32>),
}
Expand description
Models all events.
Variants
Input(Input, Option<u32>)
Input events.
Time stamp is ignored when comparing input events for equality and order.
Loop(Loop)
Events that commonly used by event loops.
Custom(EventId, Arc<dyn Any + Send + Sync + 'static>, Option<u32>)
Custom event.
When comparing two custom events for equality,
they always return false
.
When comparing partial order of two custom events,
the event ids are checked and if they are equal it returns None
.
Time stamp is ignored both when comparing custom events for equality and order.
Trait Implementations
impl AfterRenderEvent for Event
impl AfterRenderEvent for Event
pub fn from_after_render_args(
args: &AfterRenderArgs,
_old_event: &Event
) -> Option<Event>
pub fn from_after_render_args(
args: &AfterRenderArgs,
_old_event: &Event
) -> Option<Event>
Creates an after render event.
pub fn after_render<U, F>(&self, f: F) -> Option<U> where
F: FnMut(&AfterRenderArgs) -> U,
pub fn after_render<U, F>(&self, f: F) -> Option<U> where
F: FnMut(&AfterRenderArgs) -> U,
Calls closure if this is an after render event.
fn after_render_args(&self) -> Option<AfterRenderArgs>
fn after_render_args(&self) -> Option<AfterRenderArgs>
Returns after render arguments.
impl ButtonEvent for Event
impl ButtonEvent for Event
Creates a button event. Read more
Calls closure if this is a button event.
Returns button arguments.
impl CloseEvent for Event
impl CloseEvent for Event
pub fn from_close_args(args: &CloseArgs, old_event: &Event) -> Option<Event>
pub fn from_close_args(args: &CloseArgs, old_event: &Event) -> Option<Event>
Creates a close event from arguments. Read more
pub fn close<U, F>(&self, f: F) -> Option<U> where
F: FnMut(&CloseArgs) -> U,
pub fn close<U, F>(&self, f: F) -> Option<U> where
F: FnMut(&CloseArgs) -> U,
Calls closure if this is a close event.
fn close_args(&self) -> Option<CloseArgs>
fn close_args(&self) -> Option<CloseArgs>
Returns close arguments.
impl ControllerAxisEvent for Event
impl ControllerAxisEvent for Event
pub fn from_controller_axis_args(
args: ControllerAxisArgs,
old_event: &Event
) -> Option<Event>
pub fn from_controller_axis_args(
args: ControllerAxisArgs,
old_event: &Event
) -> Option<Event>
Creates a controller axis event. Read more
pub fn controller_axis<U, F>(&self, f: F) -> Option<U> where
F: FnMut(ControllerAxisArgs) -> U,
pub fn controller_axis<U, F>(&self, f: F) -> Option<U> where
F: FnMut(ControllerAxisArgs) -> U,
Calls closure if this is a controller axis event.
fn controller_axis_args(&self) -> Option<ControllerAxisArgs>
fn controller_axis_args(&self) -> Option<ControllerAxisArgs>
Returns controller axis arguments.
impl CursorEvent for Event
impl CursorEvent for Event
impl FocusEvent for Event
impl FocusEvent for Event
impl From<AfterRenderArgs> for Event
impl From<AfterRenderArgs> for Event
pub fn from(args: AfterRenderArgs) -> Event
pub fn from(args: AfterRenderArgs) -> Event
Performs the conversion.
impl From<RenderArgs> for Event
impl From<RenderArgs> for Event
pub fn from(args: RenderArgs) -> Event
pub fn from(args: RenderArgs) -> Event
Performs the conversion.
impl From<UpdateArgs> for Event
impl From<UpdateArgs> for Event
pub fn from(args: UpdateArgs) -> Event
pub fn from(args: UpdateArgs) -> Event
Performs the conversion.
impl GenericEvent for Event
impl GenericEvent for Event
impl IdleEvent for Event
impl IdleEvent for Event
impl MouseCursorEvent for Event
impl MouseCursorEvent for Event
pub fn from_pos(pos: [f64; 2], old_event: &Event) -> Option<Event>
pub fn from_pos(pos: [f64; 2], old_event: &Event) -> Option<Event>
Creates a mouse cursor event. Read more
pub fn mouse_cursor<U, F>(&self, f: F) -> Option<U> where
F: FnMut([f64; 2]) -> U,
pub fn mouse_cursor<U, F>(&self, f: F) -> Option<U> where
F: FnMut([f64; 2]) -> U,
Calls closure if this is a mouse cursor event.
fn mouse_cursor_args(&self) -> Option<[f64; 2]>
fn mouse_cursor_args(&self) -> Option<[f64; 2]>
Returns mouse cursor arguments.
impl MouseRelativeEvent for Event
impl MouseRelativeEvent for Event
pub fn from_pos(pos: [f64; 2], old_event: &Event) -> Option<Event>
pub fn from_pos(pos: [f64; 2], old_event: &Event) -> Option<Event>
Creates a mouse relative event. Read more
pub fn mouse_relative<U, F>(&self, f: F) -> Option<U> where
F: FnMut([f64; 2]) -> U,
pub fn mouse_relative<U, F>(&self, f: F) -> Option<U> where
F: FnMut([f64; 2]) -> U,
Calls closure if this is a mouse relative event.
fn mouse_relative_args(&self) -> Option<[f64; 2]>
fn mouse_relative_args(&self) -> Option<[f64; 2]>
Returns mouse relative arguments.
impl MouseScrollEvent for Event
impl MouseScrollEvent for Event
pub fn from_pos(pos: [f64; 2], old_event: &Event) -> Option<Event>
pub fn from_pos(pos: [f64; 2], old_event: &Event) -> Option<Event>
Creates a mouse scroll event. Read more
pub fn mouse_scroll<U, F>(&self, f: F) -> Option<U> where
F: FnMut([f64; 2]) -> U,
pub fn mouse_scroll<U, F>(&self, f: F) -> Option<U> where
F: FnMut([f64; 2]) -> U,
Calls a closure if this is a mouse scroll event.
fn mouse_scroll_args(&self) -> Option<[f64; 2]>
fn mouse_scroll_args(&self) -> Option<[f64; 2]>
Returns mouse scroll arguments.
impl PartialOrd<Event> for Event
impl PartialOrd<Event> for Event
pub fn partial_cmp(&self, other: &Event) -> Option<Ordering>
pub fn partial_cmp(&self, other: &Event) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
impl RenderEvent for Event
impl RenderEvent for Event
pub fn from_render_args(args: &RenderArgs, _old_event: &Event) -> Option<Event>
pub fn from_render_args(args: &RenderArgs, _old_event: &Event) -> Option<Event>
Creates a render event.
pub fn render<U, F>(&self, f: F) -> Option<U> where
F: FnMut(&RenderArgs) -> U,
pub fn render<U, F>(&self, f: F) -> Option<U> where
F: FnMut(&RenderArgs) -> U,
Calls closure if this is a render event.
fn render_args(&self) -> Option<RenderArgs>
fn render_args(&self) -> Option<RenderArgs>
Returns render arguments.
impl ResizeEvent for Event
impl ResizeEvent for Event
pub fn from_resize_args(args: &ResizeArgs, old_event: &Event) -> Option<Event>
pub fn from_resize_args(args: &ResizeArgs, old_event: &Event) -> Option<Event>
Creates a resize event. Read more
pub fn resize<U, F>(&self, f: F) -> Option<U> where
F: FnMut(&ResizeArgs) -> U,
pub fn resize<U, F>(&self, f: F) -> Option<U> where
F: FnMut(&ResizeArgs) -> U,
Calls closure if this is a resize event.
fn resize_args(&self) -> Option<ResizeArgs>
fn resize_args(&self) -> Option<ResizeArgs>
Returns resize arguments.
impl TouchEvent for Event
impl TouchEvent for Event
impl UpdateEvent for Event
impl UpdateEvent for Event
pub fn from_update_args(args: &UpdateArgs, _old_event: &Event) -> Option<Event>
pub fn from_update_args(args: &UpdateArgs, _old_event: &Event) -> Option<Event>
Creates an update event.
pub fn update<U, F>(&self, f: F) -> Option<U> where
F: FnMut(&UpdateArgs) -> U,
pub fn update<U, F>(&self, f: F) -> Option<U> where
F: FnMut(&UpdateArgs) -> U,
Calls closure if this is an update event.
fn update_args(&self) -> Option<UpdateArgs>
fn update_args(&self) -> Option<UpdateArgs>
Returns update arguments.
Auto Trait Implementations
impl !RefUnwindSafe for Event
impl Send for Event
impl Sync for Event
impl Unpin for Event
impl !UnwindSafe for Event
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> Pointable for T
impl<T> Pointable for T
impl<T> PressEvent for T where
T: ButtonEvent,
impl<T> PressEvent for T where
T: ButtonEvent,
impl<T> ReleaseEvent for T where
T: ButtonEvent,
impl<T> ReleaseEvent for T where
T: ButtonEvent,
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more