Function mles_utils::write_len_to_hdr
[−]
[src]
pub fn write_len_to_hdr(len: usize, hdrv: Vec<u8>) -> Vec<u8>
Write a length in network byte order to the header.
Example
use mles_utils::{write_hdr, write_len_to_hdr, do_hash, read_hdr_len, select_cid, read_cid_from_hdr}; let hashstr = "A string".to_string(); let hashable = vec![hashstr]; let key = do_hash(&hashable); let cid = select_cid(key); let mut hdr = write_hdr(515, cid); let hdr = write_len_to_hdr(750, hdr); assert_eq!(750, read_hdr_len(&hdr)); assert_eq!(cid, read_cid_from_hdr(&hdr));