Struct piston::Events

source ·
pub struct Events { /* private fields */ }
Expand description

An event loop iterator

Warning: Because the iterator polls events from the window back-end, it must be used on the same thread as the window back-end (usually main thread), unless the window back-end supports multi-thread event polling.

Implementations§

source§

impl Events

source

pub fn new(settings: EventSettings) -> Events

Creates a new event iterator with default UPS and FPS settings.

source

pub fn next<W>(&mut self, window: &mut W) -> Option<Event>where W: Window,

Returns the next event.

Trait Implementations§

source§

impl Clone for Events

source§

fn clone(&self) -> Events

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl Debug for Events

source§

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

Formats the value using the given formatter. Read more
source§

impl EventLoop for Events

source§

fn get_event_settings(&self) -> EventSettings

Returns event loop settings.
source§

fn set_event_settings(&mut self, settings: EventSettings)

Sets event loop settings.
source§

fn set_ups(&mut self, frames: u64)

The number of updates per second Read more
source§

fn ups(self, frames: u64) -> Self

The number of updates per second Read more
source§

fn set_ups_reset(&mut self, frames: u64)

The number of delayed updates before skipping them to catch up. When set to 0, it will always try to catch up.
source§

fn ups_reset(self, frames: u64) -> Self

The number of delayed updates before skipping them to catch up. When set to 0, it will always try to catch up.
source§

fn set_max_fps(&mut self, frames: u64)

The maximum number of frames per second Read more
source§

fn max_fps(self, frames: u64) -> Self

The maximum number of frames per second Read more
source§

fn set_swap_buffers(&mut self, enable: bool)

Enable or disable automatic swapping of buffers.
source§

fn swap_buffers(self, enable: bool) -> Self

Enable or disable automatic swapping of buffers.
source§

fn set_bench_mode(&mut self, enable: bool)

Enable or disable benchmark mode. When enabled, it will render and update without sleep and ignore input. Used to test performance by playing through as fast as possible. Requires lazy to be set to false.
source§

fn bench_mode(self, enable: bool) -> Self

Enable or disable benchmark mode. When enabled, it will render and update without sleep and ignore input. Used to test performance by playing through as fast as possible. Requires lazy to be set to false.
source§

fn set_lazy(&mut self, enable: bool)

Enable or disable rendering only when receiving input. When enabled, update events are disabled. Idle events are emitted while receiving input.
source§

fn lazy(self, enable: bool) -> Self

Enable or disable rendering only when receiving input. When enabled, update events are disabled. Idle events are emitted while receiving input.
source§

impl Copy for Events

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

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

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

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

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

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
source§

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

Performs the conversion.