Skip to content

Commit

Permalink
Fixed errors
Browse files Browse the repository at this point in the history
  • Loading branch information
markcda committed Jun 4, 2024
1 parent 1b880ee commit 8674c43
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
23 changes: 22 additions & 1 deletion src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@ impl From<&str> for CliError {
}

/// Macro to simplify `Consider` trait implementation.
#[cfg(not(any(target_arch = "wasm32", target_arch = "wasm64")))]
macro_rules! impl_consider {
($e:ty) => {
#[cfg(feature = "salvo")]
Expand All @@ -351,6 +352,7 @@ macro_rules! impl_consider {
}

/// Macro to simplify `ConsiderCli` trait implementation.
#[cfg(any(target_arch = "wasm32", target_arch = "wasm64"))]
macro_rules! impl_consider_cli {
($e:ty) => {
#[cfg(feature = "reqwest")]
Expand All @@ -373,13 +375,21 @@ macro_rules! impl_consider_cli {
};
}

#[cfg(not(any(target_arch = "wasm32", target_arch = "wasm64")))]
impl_consider!(rmp_serde::encode::Error);
#[cfg(not(any(target_arch = "wasm32", target_arch = "wasm64")))]
impl_consider!(rmp_serde::decode::Error);
#[cfg(not(any(target_arch = "wasm32", target_arch = "wasm64")))]
impl_consider!(std::io::Error);
#[cfg(not(any(target_arch = "wasm32", target_arch = "wasm64")))]
impl_consider!(log::SetLoggerError);
#[cfg(not(any(target_arch = "wasm32", target_arch = "wasm64")))]
impl_consider!(serde_json::Error);
#[cfg(not(any(target_arch = "wasm32", target_arch = "wasm64")))]
impl_consider!(salvo::Error);
#[cfg(not(any(target_arch = "wasm32", target_arch = "wasm64")))]
impl_consider!(salvo::hyper::http::status::InvalidStatusCode);
#[cfg(not(any(target_arch = "wasm32", target_arch = "wasm64")))]
impl_consider!(salvo::http::ParseError);

#[cfg(any(target_arch = "wasm32", target_arch = "wasm64"))]
Expand All @@ -396,25 +406,36 @@ impl_consider_cli!(serde_json::Error);
impl_consider_cli!(reqwest::Error);

#[cfg(feature = "bb8-redis")]
#[cfg(not(any(target_arch = "wasm32", target_arch = "wasm64")))]
impl_consider!(bb8_redis::redis::RedisError);

#[cfg(feature = "bb8-redis")]
impl_consider!(bb8_redis::bb8::RunError<bb8_redis::redis::RedisError>);
#[cfg(not(any(target_arch = "wasm32", target_arch = "wasm64")))]
impl_consider!(bb8::RunError<bb8_redis::redis::RedisError>);

#[cfg(feature = "bb8-mongo")]
#[cfg(not(any(target_arch = "wasm32", target_arch = "wasm64")))]
impl_consider!(bb8_mongodb::Error);

#[cfg(feature = "bb8-mongo")]
#[cfg(not(any(target_arch = "wasm32", target_arch = "wasm64")))]
impl_consider!(mongodb::error::Error);

#[cfg(feature = "dotenv")]
#[cfg(not(any(target_arch = "wasm32", target_arch = "wasm64")))]
impl_consider!(dotenv::Error);

#[cfg(feature = "log4rs")]
impl_consider!(log4rs::config::runtime::ConfigErrors);

#[cfg(feature = "sea-orm")]
#[cfg(not(any(target_arch = "wasm32", target_arch = "wasm64")))]
impl_consider!(sea_orm::DbErr);

#[cfg(feature = "serde-yaml")]
#[cfg(not(any(target_arch = "wasm32", target_arch = "wasm64")))]
impl_consider!(serde_yaml::Error);

#[cfg(feature = "reqwest")]
#[cfg(not(any(target_arch = "wasm32", target_arch = "wasm64")))]
impl_consider!(reqwest::Error);
6 changes: 5 additions & 1 deletion src/responses.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ use salvo::Writer as ServerResponseWriter;
#[cfg(feature = "salvo")]
use salvo::fs::NamedFile;

use serde::{de::DeserializeOwned, Serialize};
use serde::Serialize;

#[cfg(feature = "reqwest")]
#[cfg(any(target_arch = "wasm32", target_arch = "wasm64"))]
use serde::de::DeserializeOwned;

/// Macro to define the function that called the response.
#[macro_export]
Expand Down

0 comments on commit 8674c43

Please sign in to comment.