diff --git a/Cargo.toml b/Cargo.toml index 37f3d3d..ad81416 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tinify-rs" -version = "1.4.0" +version = "1.4.1" edition = "2021" description = "A Rust client for the Tinify API" authors = ["The tinify-rs Developers"] diff --git a/README.md b/README.md index 2f6ccfa..c237a08 100644 --- a/README.md +++ b/README.md @@ -40,14 +40,14 @@ Install the API client with Cargo. Add this to `Cargo.toml`: ```toml [dependencies] -tinify-rs = "1.4.0" +tinify-rs = "1.4.1" ``` Using async client ```toml [dependencies] -tinify-rs = { version = "1.4.0", features = ["async"] } +tinify-rs = { version = "1.4.1", features = ["async"] } ``` ## Usage diff --git a/src/async_bin/client.rs b/src/async_bin/client.rs index 34ad163..f4fa055 100644 --- a/src/async_bin/client.rs +++ b/src/async_bin/client.rs @@ -24,7 +24,6 @@ impl Client { { self.source.from_file(path).await } - /// Choose a buffer to compress. pub async fn from_buffer(self, buffer: &[u8]) -> Result { diff --git a/src/async_bin/source.rs b/src/async_bin/source.rs index 47f2eef..2aaf698 100644 --- a/src/async_bin/source.rs +++ b/src/async_bin/source.rs @@ -110,12 +110,11 @@ impl Source { serde_json::from_str(&compressed_image.text().await?)?; Err(TinifyError::ClientError { upstream }) } - StatusCode::SERVICE_UNAVAILABLE => { + _ => { let upstream: Upstream = serde_json::from_str(&compressed_image.text().await?)?; Err(TinifyError::ServerError { upstream }) } - _ => unreachable!(), } } diff --git a/src/sync/source.rs b/src/sync/source.rs index 19de791..974dd1c 100644 --- a/src/sync/source.rs +++ b/src/sync/source.rs @@ -106,12 +106,11 @@ impl Source { serde_json::from_str(&compressed_image.text()?)?; Err(TinifyError::ClientError { upstream }) } - StatusCode::SERVICE_UNAVAILABLE => { + _ => { let upstream: Upstream = serde_json::from_str(&compressed_image.text()?)?; Err(TinifyError::ServerError { upstream }) } - _ => unreachable!(), } } @@ -207,7 +206,7 @@ impl Source { Err(TinifyError::ClientError { upstream }) } } - + /// Save the current compressed image to a file. pub fn to_file

(&mut self, path: P) -> Result<(), TinifyError> where