Propagate error from EventLoop creation
Inner panics could make it hard to trouble shoot the issues and for some users it's not desirable. The inner panics were left only when they are used to `assert!` during development. This reverts commit 9f91bc413fe20618bd7090829832bb074aab15c3 which reverted the original patch which was merged without a proper review. Fixes: #500.
This commit is contained in:
parent
778d70c001
commit
f9758528f6
59 changed files with 353 additions and 297 deletions
|
|
@ -1,16 +1,18 @@
|
|||
use std::marker::PhantomData;
|
||||
|
||||
use crate::error::EventLoopError;
|
||||
use crate::event::Event;
|
||||
use crate::event_loop::{ControlFlow, EventLoopWindowTarget as RootEventLoopWindowTarget};
|
||||
|
||||
use super::{backend, device, window};
|
||||
|
||||
mod proxy;
|
||||
pub(crate) mod runner;
|
||||
mod state;
|
||||
mod window_target;
|
||||
|
||||
pub use self::proxy::EventLoopProxy;
|
||||
pub use self::window_target::EventLoopWindowTarget;
|
||||
|
||||
use super::{backend, device, window};
|
||||
use crate::event::Event;
|
||||
use crate::event_loop::{ControlFlow, EventLoopWindowTarget as RootEventLoopWindowTarget};
|
||||
|
||||
use std::marker::PhantomData;
|
||||
pub use proxy::EventLoopProxy;
|
||||
pub use window_target::EventLoopWindowTarget;
|
||||
|
||||
pub struct EventLoop<T: 'static> {
|
||||
elw: RootEventLoopWindowTarget<T>,
|
||||
|
|
@ -20,13 +22,13 @@ pub struct EventLoop<T: 'static> {
|
|||
pub(crate) struct PlatformSpecificEventLoopAttributes {}
|
||||
|
||||
impl<T> EventLoop<T> {
|
||||
pub(crate) fn new(_: &PlatformSpecificEventLoopAttributes) -> Self {
|
||||
EventLoop {
|
||||
pub(crate) fn new(_: &PlatformSpecificEventLoopAttributes) -> Result<Self, EventLoopError> {
|
||||
Ok(EventLoop {
|
||||
elw: RootEventLoopWindowTarget {
|
||||
p: EventLoopWindowTarget::new(),
|
||||
_marker: PhantomData,
|
||||
},
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
pub fn run<F>(self, mut event_handler: F) -> !
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue