fn put_length_prefixed<F>(&mut self, f: F)
    where
        F: FnOnce(&mut Vec<u8>),
    {
        // reserve space to write the prefixed length
        let offset = self.len();
        self.extend(&[0; 4]);

        // write the main body of the message
        f(self);

        // now calculate the size of what we wrote and set the length value
        let size = (self.len() - offset) as i32;
        self[offset..(offset + 4)].copy_from_slice(&size.to_be_bytes());
    }
// writes a length-prefixed message, this is used when encoding nearly all messages as postgres
// wants us to send the length of the often-variable-sized messages up front
writes a length-prefixed message, this is used when encoding nearly all messages as postgres
wants us to send the length of the often-variable-sized messages up front
writes a length - prefixed message this is used when encoding nearly all messages as postgres wants us to send the length of the often - variable - sized messages up front
fn put_length_prefixed<F>(&mut self, f: F)
    where
        F: FnOnce(&mut Vec<u8>),
    {
        // reserve space to write the prefixed length
        let offset = self.len();
        self.extend(&[0; 4]);
        // write the main body of the message
        f(self);
        // now calculate the size of what we wrote and set the length value
        let size = (self.len() - offset) as i32;
        self[offset..(offset + 4)].copy_from_slice(&size.to_be_bytes());
    }
fn put_length_prefixed < F > ( & mut self , f : F ) where F : FnOnce ( & mut Vec < u8 > ) , { // reserve space to write the prefixed length let offset = self . len ( ) ; self . extend ( & [ 0 ; 4 ] ) ; // write the main body of the message f ( self ) ; // now calculate the size of what we wrote and set the length value let size = ( self . len ( ) - offset ) as i32 ; self [ offset .. ( offset + 4 ) ] . copy_from_slice ( & size . to_be_bytes ( ) ) ; }
writes a length-prefixed message, this is used when encoding nearly all messages as postgres
wants us to send the length of the often-variable-sized messages up front
writes a length - prefixed message this is used when encoding nearly all messages as postgres wants us to send the length of the often - variable - sized messages up front
&mut self
f
F
&mut self
f
F