Skip to content

Commit

Permalink
Merge branch 'emilk:master' into patch22
Browse files Browse the repository at this point in the history
  • Loading branch information
rustbasic authored May 12, 2024
2 parents 2e02044 + c3f386a commit 1dd653a
Show file tree
Hide file tree
Showing 8 changed files with 97 additions and 35 deletions.
22 changes: 10 additions & 12 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -199,17 +199,16 @@ checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6"

[[package]]
name = "arboard"
version = "3.3.1"
version = "3.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1faa3c733d9a3dd6fbaf85da5d162a2e03b2e0033a90dceb0e2a90fdd1e5380a"
checksum = "9fb4009533e8ff8f1450a5bcbc30f4242a1d34442221f72314bea1f5dc9c7f89"
dependencies = [
"clipboard-win",
"log",
"objc",
"objc-foundation",
"objc_id",
"objc2 0.5.1",
"objc2-app-kit",
"objc2-foundation",
"parking_lot",
"thiserror",
"x11rb",
]

Expand Down Expand Up @@ -797,9 +796,9 @@ checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1"

[[package]]
name = "clipboard-win"
version = "5.1.0"
version = "5.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3ec832972fefb8cf9313b45a0d1945e29c9c251f1d4c6eafc5fe2124c02d2e81"
checksum = "79f4473f5144e20d9aceaf2972478f06ddf687831eafeeb434fbaf0acc4144ad"
dependencies = [
"error-code",
]
Expand Down Expand Up @@ -1146,7 +1145,7 @@ version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "330c60081dcc4c72131f8eb70510f1ac07223e5d4163db481a04a0befcffa412"
dependencies = [
"libloading 0.8.0",
"libloading 0.7.4",
]

[[package]]
Expand Down Expand Up @@ -1204,7 +1203,6 @@ dependencies = [
"ron",
"serde",
"static_assertions",
"thiserror",
"wasm-bindgen",
"wasm-bindgen-futures",
"web-sys",
Expand Down Expand Up @@ -1958,7 +1956,7 @@ dependencies = [
"bitflags 2.5.0",
"com",
"libc",
"libloading 0.8.0",
"libloading 0.7.4",
"thiserror",
"widestring",
"winapi",
Expand Down Expand Up @@ -4321,7 +4319,7 @@ dependencies = [
"js-sys",
"khronos-egl",
"libc",
"libloading 0.8.0",
"libloading 0.7.4",
"log",
"metal",
"naga",
Expand Down
1 change: 0 additions & 1 deletion crates/eframe/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ log.workspace = true
parking_lot.workspace = true
raw-window-handle.workspace = true
static_assertions = "1.1.0"
thiserror.workspace = true
web-time.workspace = true

# Optional dependencies
Expand Down
99 changes: 87 additions & 12 deletions crates/eframe/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -331,37 +331,112 @@ pub fn run_simple_native(
// ----------------------------------------------------------------------------

/// The different problems that can occur when trying to run `eframe`.
#[derive(thiserror::Error, Debug)]
#[derive(Debug)]
pub enum Error {
/// An error from [`winit`].
#[cfg(not(target_arch = "wasm32"))]
#[error("winit error: {0}")]
Winit(#[from] winit::error::OsError),
Winit(winit::error::OsError),

/// An error from [`winit::event_loop::EventLoop`].
#[cfg(not(target_arch = "wasm32"))]
#[error("winit EventLoopError: {0}")]
WinitEventLoop(#[from] winit::error::EventLoopError),
WinitEventLoop(winit::error::EventLoopError),

/// An error from [`glutin`] when using [`glow`].
#[cfg(all(feature = "glow", not(target_arch = "wasm32")))]
#[error("glutin error: {0}")]
Glutin(#[from] glutin::error::Error),
Glutin(glutin::error::Error),

/// An error from [`glutin`] when using [`glow`].
#[cfg(all(feature = "glow", not(target_arch = "wasm32")))]
#[error("Found no glutin configs matching the template: {0:?}. Error: {1:?}")]
NoGlutinConfigs(glutin::config::ConfigTemplate, Box<dyn std::error::Error>),

/// An error from [`glutin`] when using [`glow`].
#[cfg(feature = "glow")]
#[error("egui_glow: {0}")]
OpenGL(#[from] egui_glow::PainterError),
OpenGL(egui_glow::PainterError),

/// An error from [`wgpu`].
#[cfg(feature = "wgpu")]
#[error("WGPU error: {0}")]
Wgpu(#[from] egui_wgpu::WgpuError),
Wgpu(egui_wgpu::WgpuError),
}

impl std::error::Error for Error {}

#[cfg(not(target_arch = "wasm32"))]
impl From<winit::error::OsError> for Error {
#[inline]
fn from(err: winit::error::OsError) -> Self {
Self::Winit(err)
}
}

#[cfg(not(target_arch = "wasm32"))]
impl From<winit::error::EventLoopError> for Error {
#[inline]
fn from(err: winit::error::EventLoopError) -> Self {
Self::WinitEventLoop(err)
}
}

#[cfg(all(feature = "glow", not(target_arch = "wasm32")))]
impl From<glutin::error::Error> for Error {
#[inline]
fn from(err: glutin::error::Error) -> Self {
Self::Glutin(err)
}
}

#[cfg(feature = "glow")]
impl From<egui_glow::PainterError> for Error {
#[inline]
fn from(err: egui_glow::PainterError) -> Self {
Self::OpenGL(err)
}
}

#[cfg(feature = "wgpu")]
impl From<egui_wgpu::WgpuError> for Error {
#[inline]
fn from(err: egui_wgpu::WgpuError) -> Self {
Self::Wgpu(err)
}
}

impl std::fmt::Display for Error {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
#[cfg(not(target_arch = "wasm32"))]
Self::Winit(err) => {
write!(f, "winit error: {err}")
}

#[cfg(not(target_arch = "wasm32"))]
Self::WinitEventLoop(err) => {
write!(f, "winit EventLoopError: {err}")
}

#[cfg(all(feature = "glow", not(target_arch = "wasm32")))]
Self::Glutin(err) => {
write!(f, "glutin error: {err}")
}

#[cfg(all(feature = "glow", not(target_arch = "wasm32")))]
Self::NoGlutinConfigs(template, err) => {
write!(
f,
"Found no glutin configs matching the template: {template:?}. Error: {err}"
)
}

#[cfg(feature = "glow")]
Self::OpenGL(err) => {
write!(f, "egui_glow: {err}")
}

#[cfg(feature = "wgpu")]
Self::Wgpu(err) => {
write!(f, "WGPU error: {err}")
}
}
}
}

/// Short for `Result<T, eframe::Error>`.
Expand Down
2 changes: 0 additions & 2 deletions crates/egui/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -371,8 +371,6 @@
#![allow(clippy::float_cmp)]
#![allow(clippy::manual_range_contains)]
#![cfg_attr(feature = "puffin", deny(unsafe_code))]
#![cfg_attr(not(feature = "puffin"), forbid(unsafe_code))]

mod animation_manager;
pub mod containers;
Expand Down
2 changes: 0 additions & 2 deletions crates/egui_demo_lib/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
#![allow(clippy::float_cmp)]
#![allow(clippy::manual_range_contains)]
#![cfg_attr(feature = "puffin", deny(unsafe_code))]
#![cfg_attr(not(feature = "puffin"), forbid(unsafe_code))]

mod demo;
pub mod easy_mark;
Expand Down
2 changes: 0 additions & 2 deletions crates/egui_extras/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
#![allow(clippy::float_cmp)]
#![allow(clippy::manual_range_contains)]
#![cfg_attr(feature = "puffin", deny(unsafe_code))]
#![cfg_attr(not(feature = "puffin"), forbid(unsafe_code))]

#[cfg(feature = "chrono")]
mod datepicker;
Expand Down
2 changes: 0 additions & 2 deletions crates/emath/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
//!
#![allow(clippy::float_cmp)]
#![cfg_attr(feature = "puffin", deny(unsafe_code))]
#![cfg_attr(not(feature = "puffin"), forbid(unsafe_code))]

use std::ops::{Add, Div, Mul, RangeInclusive, Sub};

Expand Down
2 changes: 0 additions & 2 deletions crates/epaint/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
#![allow(clippy::float_cmp)]
#![allow(clippy::manual_range_contains)]
#![cfg_attr(feature = "puffin", deny(unsafe_code))]
#![cfg_attr(not(feature = "puffin"), forbid(unsafe_code))]

mod bezier;
pub mod color;
Expand Down

0 comments on commit 1dd653a

Please sign in to comment.