winit-core: move error

This commit is contained in:
Kirill Chibisov 2025-05-02 13:16:31 +09:00
parent 446482367b
commit fe2df61884
4 changed files with 13 additions and 6 deletions

View file

@ -299,12 +299,12 @@ pub use rwh_06 as raw_window_handle;
pub mod application; pub mod application;
#[cfg(any(doc, doctest, test))] #[cfg(any(doc, doctest, test))]
pub mod changelog; pub mod changelog;
#[macro_use]
pub mod error;
use winit_core::cursor; use winit_core::cursor;
pub mod event; pub mod event;
pub mod event_loop; pub mod event_loop;
pub use winit_core::{icon, keyboard, monitor}; pub use winit_core::{error, icon, keyboard, monitor};
#[macro_use]
mod os_error;
mod platform_impl; mod platform_impl;
use winit_core::as_any as utils; use winit_core::as_any as utils;
pub mod window; pub mod window;

6
src/os_error.rs Normal file
View file

@ -0,0 +1,6 @@
#[allow(unused_macros)]
macro_rules! os_error {
($error:expr) => {{
winit_core::error::OsError::new(line!(), file!(), $error)
}};
}

View file

@ -100,7 +100,7 @@ pub struct NotSupportedError {
} }
impl NotSupportedError { impl NotSupportedError {
pub(crate) fn new(reason: &'static str) -> Self { pub fn new(reason: &'static str) -> Self {
Self { reason } Self { reason }
} }
} }
@ -121,8 +121,7 @@ pub struct OsError {
} }
impl OsError { impl OsError {
#[allow(dead_code)] pub fn new(
pub(crate) fn new(
line: u32, line: u32,
file: &'static str, file: &'static str,
error: impl Into<Box<dyn Error + Send + Sync + 'static>>, error: impl Into<Box<dyn Error + Send + Sync + 'static>>,

View file

@ -1,6 +1,8 @@
#[macro_use] #[macro_use]
pub mod as_any; pub mod as_any;
pub mod cursor; pub mod cursor;
#[macro_use]
pub mod error;
pub mod icon; pub mod icon;
pub mod keyboard; pub mod keyboard;
pub mod monitor; pub mod monitor;