Remove EventLoopError::AlreadyRunning

This is already prevented by the type-system, and as such it doesn't
make sense to have an error case for this.
This commit is contained in:
Mads Marquart 2024-01-29 19:06:03 +01:00 committed by GitHub
parent f204467838
commit f526a47152
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 15 additions and 29 deletions

View file

@ -491,10 +491,6 @@ impl<T: 'static> EventLoop<T> {
where
F: FnMut(event::Event<T>, &event_loop::EventLoopWindowTarget),
{
if self.loop_running {
return Err(EventLoopError::AlreadyRunning);
}
loop {
match self.pump_events(None, &mut event_handler) {
PumpStatus::Exit(0) => {

View file

@ -192,10 +192,6 @@ impl<T: 'static> EventLoop<T> {
where
F: FnMut(Event<T>, &RootEventLoopWindowTarget),
{
if self.loop_running {
return Err(EventLoopError::AlreadyRunning);
}
let exit = loop {
match self.pump_events(None, &mut event_handler) {
PumpStatus::Exit(0) => {

View file

@ -402,10 +402,6 @@ impl<T: 'static> EventLoop<T> {
where
F: FnMut(Event<T>, &RootELW),
{
if self.loop_running {
return Err(EventLoopError::AlreadyRunning);
}
let exit = loop {
match self.pump_events(None, &mut event_handler) {
PumpStatus::Exit(0) => {

View file

@ -279,10 +279,6 @@ impl<T> EventLoop<T> {
where
F: FnMut(Event<T>, &RootWindowTarget),
{
if self.delegate.is_running() {
return Err(EventLoopError::AlreadyRunning);
}
let callback = map_user_event(callback, self.receiver.clone());
// # Safety

View file

@ -94,8 +94,6 @@ use crate::{
};
use runner::{EventLoopRunner, EventLoopRunnerShared};
use self::runner::RunnerState;
use super::{window::set_skip_taskbar, SelectedCursor};
/// some backends like macos uses an uninhabited `Never` type,
@ -246,9 +244,6 @@ impl<T: 'static> EventLoop<T> {
{
{
let runner = &self.window_target.p.runner_shared;
if runner.state() != RunnerState::Uninitialized {
return Err(EventLoopError::AlreadyRunning);
}
let event_loop_windows_ref = &self.window_target;
let user_event_receiver = &self.user_event_receiver;

View file

@ -143,10 +143,6 @@ impl<T> EventLoopRunner<T> {
}
}
pub fn state(&self) -> RunnerState {
self.runner_state.get()
}
pub fn set_control_flow(&self, control_flow: ControlFlow) {
self.control_flow.set(control_flow)
}