Struct winit::event_loop::EventLoopBuilder
source · pub struct EventLoopBuilder<T: 'static> {
pub(crate) platform_specific: PlatformSpecificEventLoopAttributes,
_p: PhantomData<T>,
}
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::new
or EventLoop::with_user_event
.
Fields§
§platform_specific: PlatformSpecificEventLoopAttributes
§_p: PhantomData<T>
Implementations§
source§impl EventLoopBuilder<()>
impl EventLoopBuilder<()>
source§impl<T> EventLoopBuilder<T>
impl<T> EventLoopBuilder<T>
sourcepub fn build(&mut self) -> Result<EventLoop<T>, EventLoopError>
pub fn build(&mut self) -> Result<EventLoop<T>, 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<T: Default + 'static> Default for EventLoopBuilder<T>
impl<T: Default + 'static> Default for EventLoopBuilder<T>
source§fn default() -> EventLoopBuilder<T>
fn default() -> EventLoopBuilder<T>
source§impl<T> EventLoopBuilderExtWayland for EventLoopBuilder<T>
impl<T> EventLoopBuilderExtWayland for EventLoopBuilder<T>
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<T> EventLoopBuilderExtX11 for EventLoopBuilder<T>
impl<T> EventLoopBuilderExtX11 for EventLoopBuilder<T>
Auto Trait Implementations§
impl<T> Freeze for EventLoopBuilder<T>
impl<T> RefUnwindSafe for EventLoopBuilder<T>where
T: RefUnwindSafe,
impl<T> Send for EventLoopBuilder<T>where
T: Send,
impl<T> Sync for EventLoopBuilder<T>where
T: Sync,
impl<T> Unpin for EventLoopBuilder<T>where
T: Unpin,
impl<T> UnwindSafe for EventLoopBuilder<T>where
T: UnwindSafe,
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.