pub struct WinitEventLoop { /* private fields */ }Available on crate feature
backend_winit only.Expand description
Abstracted event loop of a WinitWindow.
You can register it into calloop or call
dispatch_new_events periodically to receive any
events.
Implementations§
Source§impl WinitEventLoop
impl WinitEventLoop
Sourcepub fn dispatch_new_events<F>(&mut self, callback: F) -> PumpStatuswhere
F: FnMut(WinitEvent),
pub fn dispatch_new_events<F>(&mut self, callback: F) -> PumpStatuswhere
F: FnMut(WinitEvent),
Processes new events of the underlying event loop and calls the provided callback.
You need to periodically call this function to keep the underlying event loop and
WinitWindow active. Otherwise the window may not respond to user interaction.
Returns an error if the WinitWindow the window has been closed. Calling
dispatch_new_events again after the WinitWindow has been closed is considered an
application error and unspecified behaviour may occur.
The linked WinitGraphicsBackend will error with a lost context and should
not be used anymore as well.
Trait Implementations§
Source§impl Debug for WinitEventLoop
impl Debug for WinitEventLoop
Source§impl EventSource for WinitEventLoop
impl EventSource for WinitEventLoop
Source§const NEEDS_EXTRA_LIFECYCLE_EVENTS: bool = true
const NEEDS_EXTRA_LIFECYCLE_EVENTS: bool = true
Whether this source needs to be sent the
EventSource::before_sleep
and EventSource::before_handle_events notifications. These are opt-in because
they require more expensive checks, and almost all sources will not need these notificationsSource§type Event = WinitEvent
type Event = WinitEvent
The type of events generated by your source.
Source§type Error = Error
type Error = Error
The error type returned from
process_events() (not the user callback!).Source§fn before_sleep(&mut self) -> Result<Option<(Readiness, Token)>>
fn before_sleep(&mut self) -> Result<Option<(Readiness, Token)>>
Notification that a single
poll is about to begin Read moreSource§fn process_events<F>(
&mut self,
_readiness: Readiness,
_token: Token,
callback: F,
) -> Result<PostAction, Self::Error>
fn process_events<F>( &mut self, _readiness: Readiness, _token: Token, callback: F, ) -> Result<PostAction, Self::Error>
Process any relevant events Read more
Source§fn register(
&mut self,
poll: &mut Poll,
token_factory: &mut TokenFactory,
) -> Result<()>
fn register( &mut self, poll: &mut Poll, token_factory: &mut TokenFactory, ) -> Result<()>
Register yourself to this poll instance Read more
Source§fn reregister(
&mut self,
poll: &mut Poll,
token_factory: &mut TokenFactory,
) -> Result<()>
fn reregister( &mut self, poll: &mut Poll, token_factory: &mut TokenFactory, ) -> Result<()>
Re-register your file descriptors Read more
Source§fn unregister(&mut self, poll: &mut Poll) -> Result<()>
fn unregister(&mut self, poll: &mut Poll) -> Result<()>
Unregister your file descriptors Read more
Source§fn before_handle_events(&mut self, events: EventIterator<'_>)
fn before_handle_events(&mut self, events: EventIterator<'_>)
Notification that polling is complete, and
EventSource::process_events will
be called with the given events for this source. The iterator may be empty,
which indicates that no events were generated for this source Read moreAuto Trait Implementations§
impl !Freeze for WinitEventLoop
impl !RefUnwindSafe for WinitEventLoop
impl !Send for WinitEventLoop
impl !Sync for WinitEventLoop
impl Unpin for WinitEventLoop
impl !UnwindSafe for WinitEventLoop
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.