pub fn bin_block_len(len: usize) -> Vec<u8> {
    let mut res = vec![];

    if len <= u8::MAX as usize {
        res.push(U8_LEN);
        res.push(len as u8);
    } else if len <= u16::MAX as usize {
        res.push(U16_LEN);
        res.extend_from_slice(&len.to_le_bytes())
    } else if len <= u32::MAX as usize {
        res.push(U32_LEN);
        res.extend_from_slice(&len.to_le_bytes())
    } else {
        res.push(U64_LEN);
        res.extend_from_slice(&len.to_le_bytes())
    }

    res
}
/// Returns the number of bytes in the binary block.
Returns the number of bytes in the binary block.
Returns the number of bytes in the binary block .
pub fn bin_block_len(len: usize) -> Vec<u8> {
    let mut res = vec![];
    if len <= u8::MAX as usize {
        res.push(U8_LEN);
        res.push(len as u8);
    } else if len <= u16::MAX as usize {
        res.push(U16_LEN);
        res.extend_from_slice(&len.to_le_bytes())
    } else if len <= u32::MAX as usize {
        res.push(U32_LEN);
        res.extend_from_slice(&len.to_le_bytes())
    } else {
        res.push(U64_LEN);
        res.extend_from_slice(&len.to_le_bytes())
    }
    res
}
pub fn bin_block_len ( len : usize ) -> Vec < u8 > { let mut res = vec ! [ ] ; if len <= u8 :: MAX as usize { res . push ( U8_LEN ) ; res . push ( len as u8 ) ; } else if len <= u16 :: MAX as usize { res . push ( U16_LEN ) ; res . extend_from_slice ( & len . to_le_bytes ( ) ) } else if len <= u32 :: MAX as usize { res . push ( U32_LEN ) ; res . extend_from_slice ( & len . to_le_bytes ( ) ) } else { res . push ( U64_LEN ) ; res . extend_from_slice ( & len . to_le_bytes ( ) ) } res }
Returns the number of bytes in the binary block.
Returns the number of bytes in the binary block .
len
usize
len
usize