pub fn calc_serialized_data_size_bounded<T: ?Sized>(value: &T, max: u64) -> Result<u64>
where
    T: ser::Serialize,
{
    let mut checker = SizeChecker {
        counter: Bounded(max),
        pos: 0,
    };

    match value.serialize(&mut checker) {
        Ok(_) => Ok(max - checker.counter.0),
        Err(e) => Err(e),
    }
}
/// Given a maximum size limit, check how large an object would be if it were
/// to be serialized.
Given a maximum size limit, check how large an object would be if it were
to be serialized.
Given a maximum size limit check how large an object would be if it were to be serialized .
pub fn calc_serialized_data_size_bounded<T: ?Sized>(value: &T, max: u64) -> Result<u64>
where
    T: ser::Serialize,
{
    let mut checker = SizeChecker {
        counter: Bounded(max),
        pos: 0,
    };
    match value.serialize(&mut checker) {
        Ok(_) => Ok(max - checker.counter.0),
        Err(e) => Err(e),
    }
}
pub fn calc_serialized_data_size_bounded < T : ? Sized > ( value : & T , max : u64 ) -> Result < u64 > where T : ser :: Serialize , { let mut checker = SizeChecker { counter : Bounded ( max ) , pos : 0 , } ; match value . serialize ( & mut checker ) { Ok ( _ ) => Ok ( max - checker . counter . 0 ) , Err ( e ) => Err ( e ) , } }
Given a maximum size limit, check how large an object would be if it were
to be serialized.
Given a maximum size limit check how large an object would be if it were to be serialized .
value
&T
max
u64