Skip to content

Commit

Permalink
apply feature gate
Browse files Browse the repository at this point in the history
  • Loading branch information
al8n committed Jun 28, 2023
1 parent e26d996 commit cd5f3b5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 1 addition & 2 deletions ethabi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ pub mod param_type;
mod signature;
mod state_mutability;
pub mod token;
#[cfg(feature = "serde")]
mod tuple_param;
mod util;

Expand All @@ -57,7 +56,7 @@ mod tests;

pub use ethereum_types;

#[cfg(feature = "serde")]

pub use crate::tuple_param::TupleParam;
pub use crate::{
constructor::Constructor,
Expand Down
5 changes: 5 additions & 0 deletions ethabi/src/tuple_param.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use crate::no_std_prelude::*;
use crate::{param_type::Writer, ParamType};
use core::fmt;
#[cfg(feature = "serde")]
use serde::{
de::{Error, MapAccess, Visitor},
ser::SerializeMap,
Expand All @@ -37,6 +38,7 @@ impl From<ParamType> for TupleParam {
}
}

#[cfg(feature = "serde")]
impl<'a> Deserialize<'a> for TupleParam {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
Expand All @@ -46,8 +48,10 @@ impl<'a> Deserialize<'a> for TupleParam {
}
}

#[cfg(feature = "serde")]
struct TupleParamVisitor;

#[cfg(feature = "serde")]
impl<'a> Visitor<'a> for TupleParamVisitor {
type Value = TupleParam;

Expand Down Expand Up @@ -101,6 +105,7 @@ impl<'a> Visitor<'a> for TupleParamVisitor {
}
}

#[cfg(feature = "serde")]
impl Serialize for TupleParam {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
Expand Down

0 comments on commit cd5f3b5

Please sign in to comment.