Function zebra_state::service::finalized_state::disk_format::truncate_zero_be_bytes
source · pub fn truncate_zero_be_bytes(
mem_bytes: &[u8],
disk_len: usize,
) -> Option<&[u8]>
Expand description
Truncates mem_bytes
to disk_len
, by removing zero bytes from the start of the slice.
Used to discard unused zero bytes during serialization.
Return None
if any of the truncated bytes are non-zero
§Panics
- if
mem_bytes
is shorter thandisk_len
.