MCPcopy Create free account
hub / github.com/RustCrypto/utils / serialize

Method serialize

block-buffer/src/lib.rs:325–332  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

323 /// Serialize buffer into a byte array.
324 #[allow(clippy::missing_panics_doc)]
325 pub fn serialize(&self) -> SerializedBuffer<BS, K> {
326 let mut buf = SerializedBuffer::<BS, K>::default();
327 let data = self.get_data();
328 let (pos, block) = buf.split_at_mut(1);
329 pos[0] = u8::try_from(data.len()).expect("buffer size is smaller than 256");
330 block[..data.len()].copy_from_slice(data);
331 buf
332 }
333
334 /// Deserialize buffer from a byte array.
335 ///

Callers 3

test_eager_serializeFunction · 0.45
test_lazy_serializeFunction · 0.45
test_read_serializeFunction · 0.45

Calls 4

defaultFunction · 0.85
get_dataMethod · 0.80
expectMethod · 0.80
lenMethod · 0.80

Tested by 3

test_eager_serializeFunction · 0.36
test_lazy_serializeFunction · 0.36
test_read_serializeFunction · 0.36