Add reformat to the CI (#21)
This commit is contained in:
parent
df091d59dd
commit
5674886dfa
7 changed files with 112 additions and 78 deletions
18
src/error.rs
18
src/error.rs
|
|
@ -1,5 +1,5 @@
|
|||
use std::error::Error;
|
||||
use raw_window_handle::{RawDisplayHandle, RawWindowHandle};
|
||||
use std::error::Error;
|
||||
use thiserror::Error;
|
||||
|
||||
#[derive(Error, Debug)]
|
||||
|
|
@ -12,7 +12,7 @@ pub enum SwBufError {
|
|||
human_readable_window_platform_name: &'static str,
|
||||
human_readable_display_platform_name: &'static str,
|
||||
window_handle: RawWindowHandle,
|
||||
display_handle: RawDisplayHandle
|
||||
display_handle: RawDisplayHandle,
|
||||
},
|
||||
|
||||
#[error("The provided window handle is null.")]
|
||||
|
|
@ -22,13 +22,19 @@ pub enum SwBufError {
|
|||
IncompleteDisplayHandle,
|
||||
|
||||
#[error("Platform error")]
|
||||
PlatformError(Option<String>, Option<Box<dyn Error>>)
|
||||
PlatformError(Option<String>, Option<Box<dyn Error>>),
|
||||
}
|
||||
|
||||
#[allow(unused)] // This isn't used on all platforms
|
||||
pub(crate) fn unwrap<T, E: std::error::Error + 'static>(res: Result<T, E>, str: &str) -> Result<T, SwBufError>{
|
||||
match res{
|
||||
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))))
|
||||
Err(e) => Err(SwBufError::PlatformError(
|
||||
Some(str.into()),
|
||||
Some(Box::new(e)),
|
||||
)),
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue