fn u8_slice_to_bytes(bytes: &[u8]) -> Result<Vec<u8>, Error> {
    let serialized_length = u8_slice_serialized_length(bytes);
    let mut vec = try_vec_with_capacity(serialized_length)?;
    let length_prefix = bytes.len() as u32;
    let length_prefix_bytes = length_prefix.to_le_bytes();
    vec.extend_from_slice(&length_prefix_bytes);
    vec.extend_from_slice(bytes);
    Ok(vec)
}
/// Serializes a slice of bytes with a length prefix.
///
/// This function is serializing a slice of bytes with an addition of a 4 byte length prefix.
///
/// For safety you should prefer to use [`vec_u8_to_bytes`]. For efficiency reasons you should also
/// avoid using serializing Vec<u8>.
Serializes a slice of bytes with a length prefix.
This function is serializing a slice of bytes with an addition of a 4 byte length prefix.

For safety you should prefer to use [`vec_u8_to_bytes`]. For efficiency reasons you should also
avoid using serializing Vec.
Serializes a slice of bytes with a length prefix . This function is serializing a slice of bytes with an addition of a 4 byte length prefix . For safety you should prefer to use [ ` vec_u8_to_bytes ` ] . For efficiency reasons you should also avoid using serializing Vec .
fn u8_slice_to_bytes(bytes: &[u8]) -> Result<Vec<u8>, Error> {
    let serialized_length = u8_slice_serialized_length(bytes);
    let mut vec = try_vec_with_capacity(serialized_length)?;
    let length_prefix = bytes.len() as u32;
    let length_prefix_bytes = length_prefix.to_le_bytes();
    vec.extend_from_slice(&length_prefix_bytes);
    vec.extend_from_slice(bytes);
    Ok(vec)
}
fn u8_slice_to_bytes ( bytes : & [ u8 ] ) -> Result < Vec < u8 > , Error > { let serialized_length = u8_slice_serialized_length ( bytes ) ; let mut vec = try_vec_with_capacity ( serialized_length ) ? ; let length_prefix = bytes . len ( ) as u32 ; let length_prefix_bytes = length_prefix . to_le_bytes ( ) ; vec . extend_from_slice ( & length_prefix_bytes ) ; vec . extend_from_slice ( bytes ) ; Ok ( vec ) }
Serializes a slice of bytes with a length prefix.
Serializes a slice of bytes with a length prefix .
bytes
&[u8]
bytes
&[u8]