Struct EventLoopBuilder
pub struct EventLoopBuilder<T>where
T: 'static,{ /* 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::new or EventLoop::with_user_event.
Implementations§
§impl EventLoopBuilder<()>
impl EventLoopBuilder<()>
pub fn new() -> EventLoopBuilder<()>
👎Deprecated: use EventLoop::builder instead
pub fn new() -> EventLoopBuilder<()>
EventLoop::builder insteadStart building a new event loop.
§impl<T> EventLoopBuilder<T>
impl<T> EventLoopBuilder<T>
pub 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
WaylandorX11unsetWAYLAND_DISPLAYorDISPLAYrespectively when building the event loop. - Android: must be configured with an
AndroidAppfromandroid_main()by calling.with_android_app(app)before calling.build(), otherwise it’ll panic.
Trait Implementations§
§impl<T> Default for EventLoopBuilder<T>where
T: Default + 'static,
impl<T> Default for EventLoopBuilder<T>where
T: Default + 'static,
§fn default() -> EventLoopBuilder<T>
fn default() -> EventLoopBuilder<T>
§impl<T> EventLoopBuilderExtWayland for EventLoopBuilder<T>
impl<T> EventLoopBuilderExtWayland for EventLoopBuilder<T>
§fn with_wayland(&mut self) -> &mut EventLoopBuilder<T>
fn with_wayland(&mut self) -> &mut EventLoopBuilder<T>
§fn with_any_thread(&mut self, any_thread: bool) -> &mut EventLoopBuilder<T>
fn with_any_thread(&mut self, any_thread: bool) -> &mut EventLoopBuilder<T>
§impl<T> EventLoopBuilderExtX11 for EventLoopBuilder<T>
impl<T> EventLoopBuilderExtX11 for EventLoopBuilder<T>
§fn with_x11(&mut self) -> &mut EventLoopBuilder<T>
fn with_x11(&mut self) -> &mut EventLoopBuilder<T>
§fn with_any_thread(&mut self, any_thread: bool) -> &mut EventLoopBuilder<T>
fn with_any_thread(&mut self, any_thread: bool) -> &mut 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
§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>
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>
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)
&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)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> InitializeFromFunction<T> for T
impl<T> InitializeFromFunction<T> for T
§fn initialize_from_function(f: fn() -> T) -> T
fn initialize_from_function(f: fn() -> T) -> T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more