pub fn fix_len(&mut self, msg: &mut [u8], len_off: usize, pre_len: usize) -> Result<(), Error> {
        if msg.len() < pre_len || msg.len() > pre_len + u16::MAX as usize {
            return Err(ERR_RES_TOO_LONG.to_owned());
        }

        let con_len = msg.len() - pre_len;

        // Fill in the length now that we know how long the content is.
        msg[len_off] = ((con_len >> 8) & 0xFF) as u8;
        msg[len_off + 1] = (con_len & 0xFF) as u8;
        self.length = con_len as u16;

        Ok(())
    }
// fixLen updates a packed ResourceHeader to include the length of the
// ResourceBody.
//
// lenOff is the offset of the ResourceHeader.Length field in msg.
//
// preLen is the length that msg was before the ResourceBody was packed.
fixLen updates a packed ResourceHeader to include the length of the
ResourceBody.

lenOff is the offset of the ResourceHeader.Length field in msg.

preLen is the length that msg was before the ResourceBody was packed.
fixLen updates a packed ResourceHeader to include the length of the ResourceBody . lenOff is the offset of the ResourceHeader . Length field in msg . preLen is the length that msg was before the ResourceBody was packed .
pub fn fix_len(&mut self, msg: &mut [u8], len_off: usize, pre_len: usize) -> Result<(), Error> {
        if msg.len() < pre_len || msg.len() > pre_len + u16::MAX as usize {
            return Err(ERR_RES_TOO_LONG.to_owned());
        }
        let con_len = msg.len() - pre_len;
        // Fill in the length now that we know how long the content is.
        msg[len_off] = ((con_len >> 8) & 0xFF) as u8;
        msg[len_off + 1] = (con_len & 0xFF) as u8;
        self.length = con_len as u16;
        Ok(())
    }
pub fn fix_len ( & mut self , msg : & mut [ u8 ] , len_off : usize , pre_len : usize ) -> Result < ( ) , Error > { if msg . len ( ) < pre_len || msg . len ( ) > pre_len + u16 :: MAX as usize { return Err ( ERR_RES_TOO_LONG . to_owned ( ) ) ; } let con_len = msg . len ( ) - pre_len ; // Fill in the length now that we know how long the content is. msg [ len_off ] = ( ( con_len >> 8 ) & 0xFF ) as u8 ; msg [ len_off + 1 ] = ( con_len & 0xFF ) as u8 ; self . length = con_len as u16 ; Ok ( ( ) ) }
fixLen updates a packed ResourceHeader to include the length of the
ResourceBody.
fixLen updates a packed ResourceHeader to include the length of the ResourceBody .
&mut self
msg
&mut [u8]
len_off
usize
pre_len
usize
&mut self
msg
&mut [u8]
len_off
usize
pre_len
usize