Skip to content

Commit

Permalink
change both to stripped
Browse files Browse the repository at this point in the history
  • Loading branch information
shekhirin committed Nov 9, 2021
1 parent dbd7487 commit 9d8d532
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions primitive-types/impls/serde/src/serialize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ impl fmt::Display for FromHexError {
}
}

/// Decode given (both 0x-prefixed or not) hex string into a vector of bytes.
/// Decode given 0x-prefix-stripped hex string into a vector of bytes.
///
/// Returns an error if non-hex characters are present.
pub fn from_hex(v: &str) -> Result<Vec<u8>, FromHexError> {
Expand All @@ -100,7 +100,7 @@ pub fn from_hex(v: &str) -> Result<Vec<u8>, FromHexError> {
Ok(bytes)
}

/// Decode given (both 0x-prefixed or not) hex string into provided slice.
/// Decode given 0x-prefix-stripped hex string into provided slice.
/// Used internally by `from_hex` and `deserialize_check_len`.
///
/// The method will panic if `bytes` have incorrect length (make sure to allocate enough beforehand).
Expand Down Expand Up @@ -204,7 +204,7 @@ where
type Value = Vec<u8>;

fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
write!(formatter, "a (both 0x-prefixed or not) hex string")
write!(formatter, "a 0x-prefix-stripped hex string")
}

fn visit_str<E: de::Error>(self, v: &str) -> Result<Self::Value, E> {
Expand Down Expand Up @@ -233,7 +233,7 @@ where
type Value = usize;

fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
write!(formatter, "a (both 0x-prefixed or not) hex string with {}", self.len)
write!(formatter, "a 0x-prefix-stripped hex string with {}", self.len)
}

fn visit_str<E: de::Error>(self, v: &str) -> Result<Self::Value, E> {
Expand Down

0 comments on commit 9d8d532

Please sign in to comment.