pub struct WindowRunner;
Expand description
A struct responsible for managing the application window lifecycle.
The WindowRunner
struct provides functionality to run an application
that utilizes an event loop for window management. It abstracts the details
of creating and running the event loop, making it easier to integrate window
handling into your game application.
Implementations§
Source§impl WindowRunner
impl WindowRunner
Sourcepub fn run_app(
handler: &mut dyn AppHandler,
title: &str,
) -> Result<(), EventLoopError>
pub fn run_app( handler: &mut dyn AppHandler, title: &str, ) -> Result<(), EventLoopError>
Runs the application with the provided handler.
This method initializes an event loop and starts the application by
executing the provided AppHandler
. The event loop runs in a polling
mode, allowing for responsive event handling. It is not guaranteed to ever return.
§Parameters
handler
: A mutable reference to an object implementing theAppHandler
trait, which defines the behavior of the application in response to events.
§Returns
This method returns a Result<(), EventLoopError>
.
If an error occurs during event loop creation, it returns an EventLoopError
.
§Note
It is not guaranteed to ever return, as the event loop will run indefinitely until the application is terminated.
Auto Trait Implementations§
impl Freeze for WindowRunner
impl RefUnwindSafe for WindowRunner
impl Send for WindowRunner
impl Sync for WindowRunner
impl Unpin for WindowRunner
impl UnwindSafe for WindowRunner
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
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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
.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.