MCPcopy Create free account
hub / github.com/QMHTMY/RustBook / serialize

Function serialize

code/chapter09/blockchain/blockchain1/utils/src/serializer.rs:7–11  ·  view source on GitHub ↗

序列化数据

(value: &T)

Source from the content-addressed store, hash-verified

5
6// 序列化数据
7pub fn serialize<T: ?Sized>(value: &T) -> Vec<u8>
8 where T: Serialize,
9{
10 bincode::serialize(value).unwrap()
11}
12
13// 计算 value 哈希值并以 String 形式返回
14pub fn hash_str(value: &[u8]) -> String {

Callers 2

newMethod · 0.50
set_hashMethod · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected