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

Function serialize

code/chapter09/blockchain/blockchain3/utils/src/serializer.rs:6–10  ·  view source on GitHub ↗
(value: &T)

Source from the content-addressed store, hash-verified

4use crypto::sha3::Sha3;
5
6pub fn serialize<T: ?Sized>(value: &T) -> Vec<u8>
7 where T: Serialize,
8{
9 bincode::serialize(value).unwrap()
10}
11
12pub fn hash_str(value: &[u8]) -> String {
13 let mut hasher = Sha3::sha3_256();

Callers 4

prepare_dataMethod · 0.50
write_blockMethod · 0.50
write_tailMethod · 0.50
newMethod · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected