Take a reference to a window in GraphicsContext::new, like glutin and wgpu
This commit is contained in:
parent
85b4f189bd
commit
99d63063b6
13 changed files with 40 additions and 78 deletions
|
|
@ -1,14 +1,13 @@
|
|||
use std::error::Error;
|
||||
use raw_window_handle::{HasRawWindowHandle, RawDisplayHandle, RawWindowHandle};
|
||||
use raw_window_handle::{RawDisplayHandle, RawWindowHandle};
|
||||
use thiserror::Error;
|
||||
|
||||
#[derive(Error, Debug)]
|
||||
pub enum SwBufError<W: HasRawWindowHandle> {
|
||||
pub enum SwBufError {
|
||||
#[error(
|
||||
"The provided window returned an unsupported platform: {human_readable_window_platform_name}, {human_readable_display_platform_name}."
|
||||
)]
|
||||
UnsupportedPlatform {
|
||||
window: W,
|
||||
human_readable_window_platform_name: &'static str,
|
||||
human_readable_display_platform_name: &'static str,
|
||||
window_handle: RawWindowHandle,
|
||||
|
|
@ -19,9 +18,9 @@ pub enum SwBufError<W: HasRawWindowHandle> {
|
|||
}
|
||||
|
||||
#[allow(unused)] // This isn't used on all platforms
|
||||
pub(crate) fn unwrap<T, E: std::error::Error + 'static, W: HasRawWindowHandle>(res: Result<T, E>, str: &str) -> Result<T, SwBufError<W>>{
|
||||
pub(crate) fn unwrap<T, E: std::error::Error + 'static>(res: Result<T, E>, str: &str) -> Result<T, SwBufError>{
|
||||
match res{
|
||||
Ok(t) => Ok(t),
|
||||
Err(e) => Err(SwBufError::PlatformError(Some(str.into()), Some(Box::new(e))))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue