Skip to content

Commit

Permalink
fix docs
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse committed Apr 3, 2024
1 parent 652787d commit e14da5b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions crates/serde/src/num.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ impl<'de> Deserialize<'de> for U64HexOrNumber {
}
}

/// serde functions for handling `u8` as [U8]
/// serde functions for handling `u8` as [U8](alloy_primitives::U8)
pub mod u8_hex {
use alloy_primitives::U8;
use serde::{Deserialize, Deserializer, Serialize, Serializer};
Expand All @@ -91,7 +91,7 @@ pub mod u8_hex {
}
}

/// serde functions for handling `Option<u8>` as [U8]
/// serde functions for handling `Option<u8>` as [U8](alloy_primitives::U8)
pub mod u8_hex_opt {
use alloy_primitives::U8;
use serde::{Deserialize, Deserializer, Serialize, Serializer};
Expand Down Expand Up @@ -244,12 +244,12 @@ where
NumberOrHexU256::deserialize(deserializer)?.try_into_u256()
}

/// serde functions for handling primitive `u128` as [U128]
/// serde functions for handling primitive `u128` as [U128](alloy_primitives::U128)
pub mod u128_hex_or_decimal {
use alloy_primitives::U128;
use serde::{Deserialize, Deserializer, Serialize, Serializer};

/// Deserializes an `u64` accepting a hex quantity string with optional 0x prefix or
/// Deserializes an `u128` accepting a hex quantity string with optional 0x prefix or
/// a number
pub fn deserialize<'de, D>(deserializer: D) -> Result<u128, D::Error>
where
Expand All @@ -258,7 +258,7 @@ pub mod u128_hex_or_decimal {
U128::deserialize(deserializer).map(|val| val.to())
}

/// Serializes u64 as hex string
/// Serializes u128 as hex string
pub fn serialize<S: Serializer>(value: &u128, s: S) -> Result<S::Ok, S::Error> {
U128::from(*value).serialize(s)
}
Expand Down

0 comments on commit e14da5b

Please sign in to comment.