Revert "Propagate error from EventLoop creation" (#3010)

This reverts commit ed26dd58fd.
The patched was merged with a review by accident.
This commit is contained in:
Kirill Chibisov 2023-08-06 06:07:01 +04:00 committed by GitHub
parent ed26dd58fd
commit 793c535b01
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
57 changed files with 291 additions and 344 deletions

View file

@ -30,7 +30,7 @@ pub struct OsError {
/// A general error that may occur while running the Winit event loop
#[derive(Debug)]
pub enum EventLoopError {
pub enum RunLoopError {
/// The operation is not supported by the backend.
NotSupported(NotSupportedError),
/// The OS cannot perform the operation.
@ -41,12 +41,6 @@ pub enum EventLoopError {
ExitFailure(i32),
}
impl From<OsError> for EventLoopError {
fn from(value: OsError) -> Self {
Self::Os(value)
}
}
impl NotSupportedError {
#[inline]
#[allow(dead_code)]
@ -100,13 +94,13 @@ impl fmt::Display for NotSupportedError {
}
}
impl fmt::Display for EventLoopError {
impl fmt::Display for RunLoopError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> {
match self {
EventLoopError::AlreadyRunning => write!(f, "EventLoop is already running"),
EventLoopError::NotSupported(e) => e.fmt(f),
EventLoopError::Os(e) => e.fmt(f),
EventLoopError::ExitFailure(status) => write!(f, "Exit Failure: {status}"),
RunLoopError::AlreadyRunning => write!(f, "EventLoop is already running"),
RunLoopError::NotSupported(e) => e.fmt(f),
RunLoopError::Os(e) => e.fmt(f),
RunLoopError::ExitFailure(status) => write!(f, "Exit Failure: {status}"),
}
}
}
@ -114,7 +108,7 @@ impl fmt::Display for EventLoopError {
impl error::Error for OsError {}
impl error::Error for ExternalError {}
impl error::Error for NotSupportedError {}
impl error::Error for EventLoopError {}
impl error::Error for RunLoopError {}
#[cfg(test)]
mod tests {