MCPcopy Create free account
hub / github.com/cosdata/cosdata / visit_str

Method visit_str

src/models/collection_transaction.rs:107–123  ·  view source on GitHub ↗
(self, v: &str)

Source from the content-addressed store, hash-verified

105 }
106
107 fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
108 where
109 E: de::Error,
110 {
111 let v = v
112 .strip_prefix("0x")
113 .ok_or_else(|| E::custom("missing `0x` prefix"))?;
114
115 if v.len() != 8 {
116 return Err(E::custom(
117 "hex string must be 8 characters after the `0x` prefix",
118 ));
119 }
120
121 let val = u32::from_str_radix(v, 16).map_err(E::custom)?;
122 Ok(ExplicitTransactionID(val))
123 }
124}
125
126impl<'de> Deserialize<'de> for ExplicitTransactionID {

Callers

nothing calls this directly

Calls 2

lenMethod · 0.45

Tested by

no test coverage detected