Struct winit::event_loop::EventLoopBuilder
source · pub struct EventLoopBuilder { /* private fields */ }
Expand description
Object that allows building the event loop.
This is used to make specifying options that affect the whole application easier. But note that constructing multiple event loops is not supported.
This can be created using EventLoop::builder
.
Implementations§
source§impl EventLoopBuilder
impl EventLoopBuilder
sourcepub fn build(&mut self) -> Result<EventLoop, EventLoopError>
pub fn build(&mut self) -> Result<EventLoop, EventLoopError>
Builds a new event loop.
For cross-platform compatibility, the EventLoop
must be created on the main thread,
and only once per application.
Calling this function will result in display backend initialisation.
§Panics
Attempting to create the event loop off the main thread will panic. This
restriction isn’t strictly necessary on all platforms, but is imposed to
eliminate any nasty surprises when porting to platforms that require it.
EventLoopBuilderExt::any_thread
functions are exposed in the relevant
platform
module if the target platform supports creating an event
loop on any thread.
§Platform-specific
- Wayland/X11: to prevent running under
Wayland
orX11
unsetWAYLAND_DISPLAY
orDISPLAY
respectively when building the event loop. - Android: must be configured with an
AndroidApp
fromandroid_main()
by calling.with_android_app(app)
before calling.build()
, otherwise it’ll panic.
Trait Implementations§
source§impl Debug for EventLoopBuilder
impl Debug for EventLoopBuilder
source§impl Default for EventLoopBuilder
impl Default for EventLoopBuilder
source§fn default() -> EventLoopBuilder
fn default() -> EventLoopBuilder
source§impl EventLoopBuilderExtWayland for EventLoopBuilder
impl EventLoopBuilderExtWayland for EventLoopBuilder
source§fn with_wayland(&mut self) -> &mut Self
fn with_wayland(&mut self) -> &mut Self
source§fn with_any_thread(&mut self, any_thread: bool) -> &mut Self
fn with_any_thread(&mut self, any_thread: bool) -> &mut Self
source§impl Hash for EventLoopBuilder
impl Hash for EventLoopBuilder
source§impl PartialEq for EventLoopBuilder
impl PartialEq for EventLoopBuilder
impl Eq for EventLoopBuilder
impl StructuralPartialEq for EventLoopBuilder
Auto Trait Implementations§
impl Freeze for EventLoopBuilder
impl RefUnwindSafe for EventLoopBuilder
impl Send for EventLoopBuilder
impl Sync for EventLoopBuilder
impl Unpin for EventLoopBuilder
impl UnwindSafe for EventLoopBuilder
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.