From 7fa10fb95568bb32fb6d976c70214aa02c01244d Mon Sep 17 00:00:00 2001 From: Alexander Koz Date: Thu, 28 Sep 2023 23:38:21 +0400 Subject: [PATCH] fix two -sys in deps tree --- Cargo.lock | 6 +++--- api/sound/src/sample.rs | 10 +++++++++- api/sys/Cargo.toml | 2 +- api/sys/src/sys/error/mod.rs | 1 - 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 15626d0b..983d7ba0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -62,9 +62,9 @@ checksum = "b84bf0a05bbb2a83e5eb6fa36bb6e87baa08193c35ff52bbf6b38d8af2890e46" [[package]] name = "anstyle-parse" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "938874ff5980b03a87c5524b3ae5b59cf99b1d6bc836848df7bc5ada9643c333" +checksum = "317b9a89c1868f5ea6ff1d9539a69f45dffc21ce321ac1fd1160dfa48c8e2140" dependencies = [ "utf8parse", ] @@ -2627,7 +2627,7 @@ dependencies = [ [[package]] name = "playdate-sys" -version = "0.2.0" +version = "0.2.1" dependencies = [ "heapless", "playdate-bindgen", diff --git a/api/sound/src/sample.rs b/api/sound/src/sample.rs index ac806f1e..bbf69bec 100644 --- a/api/sound/src/sample.rs +++ b/api/sound/src/sample.rs @@ -102,7 +102,15 @@ impl Sample { pub fn new_for_file_with>(api: Api, path: P) -> Result { let size = match fs::metadata(path) { Ok(stats) => stats.size, - Err(err) => return Err(ApiError::from_err(err)), + Err(err) => { + return match err { + fs::error::ApiError::Api(err) => Err(ApiError::Api(err.into())), + fs::error::ApiError::Utf8(err) => Err(ApiError::Utf8(err)), + fs::error::ApiError::FromUtf8(err) => Err(ApiError::FromUtf8(err)), + fs::error::ApiError::CStr(err) => Err(ApiError::CStr(err)), + fs::error::ApiError::NullPtr(_) => Err(ApiError::NullPtr(sys::error::NullPtrError)), + } + }, // Err(err) => return Err(ApiError::from_err(err)), }; Self::new_with_size_with(api, size as _).map_err(Into::into) diff --git a/api/sys/Cargo.toml b/api/sys/Cargo.toml index 05f50df6..4fd38767 100644 --- a/api/sys/Cargo.toml +++ b/api/sys/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "playdate-sys" -version = "0.2.0" +version = "0.2.1" build = "src/build.rs" readme = "README.md" description = "Low-level Playdate API bindings" diff --git a/api/sys/src/sys/error/mod.rs b/api/sys/src/sys/error/mod.rs index 3e406ec2..6db7ae84 100644 --- a/api/sys/src/sys/error/mod.rs +++ b/api/sys/src/sys/error/mod.rs @@ -21,7 +21,6 @@ pub enum Error { NullPtrCtx(null::ctx::NullPtrError), } -// impl fmt::Display for Error { impl fmt::Display for Error { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match &self {