pub fn serialize_data<T: ?Sized, S, E>(value: &T, size_limit: S) -> Result<Vec<u8>>
where
    T: ser::Serialize,
    S: SizeLimit,
    E: ByteOrder,
{
    let mut writer = match size_limit.limit() {
        Some(limit) => {
            let actual_size = calc_serialized_data_size_bounded(value, limit)?;
            Vec::with_capacity(actual_size as usize)
        }
        None => {
            let size = calc_serialized_data_size(value) as usize;
            Vec::with_capacity(size)
        }
    };

    serialize_data_into::<_, _, _, E>(&mut writer, value, Infinite)?;
    Ok(writer)
}
/// Serializes a serializable object into a `Vec` of bytes.
Serializes a serializable object into a `Vec` of bytes.
Serializes a serializable object into a ` Vec ` of bytes .
pub fn serialize_data<T: ?Sized, S, E>(value: &T, size_limit: S) -> Result<Vec<u8>>
where
    T: ser::Serialize,
    S: SizeLimit,
    E: ByteOrder,
{
    let mut writer = match size_limit.limit() {
        Some(limit) => {
            let actual_size = calc_serialized_data_size_bounded(value, limit)?;
            Vec::with_capacity(actual_size as usize)
        }
        None => {
            let size = calc_serialized_data_size(value) as usize;
            Vec::with_capacity(size)
        }
    };
    serialize_data_into::<_, _, _, E>(&mut writer, value, Infinite)?;
    Ok(writer)
}
pub fn serialize_data < T : ? Sized , S , E > ( value : & T , size_limit : S ) -> Result < Vec < u8 > > where T : ser :: Serialize , S : SizeLimit , E : ByteOrder , { let mut writer = match size_limit . limit ( ) { Some ( limit ) => { let actual_size = calc_serialized_data_size_bounded ( value , limit ) ? ; Vec :: with_capacity ( actual_size as usize ) } None => { let size = calc_serialized_data_size ( value ) as usize ; Vec :: with_capacity ( size ) } } ; serialize_data_into :: < _ , _ , _ , E > ( & mut writer , value , Infinite ) ? ; Ok ( writer ) }
Serializes a serializable object into a `Vec` of bytes.
Serializes a serializable object into a ` Vec ` of bytes .
value
&T
size_limit
S