pub fn encode_varint_4<T: Write>(varint: Varint, output: &mut T) -> IoResult<()> {
    let number = match varint {
        Varint::Unknown => FOUR_FLAG | (FOUR_FLAG - 1),
        Varint::Value(too_big) if too_big > FOUR_MAX => {
            return Err(IoError::new(ErrorKind::InvalidInput, WriteError::OutOfRange))
        },
        Varint::Value(value) => FOUR_FLAG | value
    };

    let mut buffer = [0; 4];
    buffer.as_mut().put_u32(number as u32);

    output.write_all(&buffer)
}
// tries to write a varint with a fixed 4-byte representation
tries to write a varint with a fixed 4-byte representation
tries to write a varint with a fixed 4 - byte representation
pub fn encode_varint_4<T: Write>(varint: Varint, output: &mut T) -> IoResult<()> {
    let number = match varint {
        Varint::Unknown => FOUR_FLAG | (FOUR_FLAG - 1),
        Varint::Value(too_big) if too_big > FOUR_MAX => {
            return Err(IoError::new(ErrorKind::InvalidInput, WriteError::OutOfRange))
        },
        Varint::Value(value) => FOUR_FLAG | value
    };
    let mut buffer = [0; 4];
    buffer.as_mut().put_u32(number as u32);
    output.write_all(&buffer)
}
pub fn encode_varint_4 < T : Write > ( varint : Varint , output : & mut T ) -> IoResult < ( ) > { let number = match varint { Varint :: Unknown => FOUR_FLAG | ( FOUR_FLAG - 1 ) , Varint :: Value ( too_big ) if too_big > FOUR_MAX => { return Err ( IoError :: new ( ErrorKind :: InvalidInput , WriteError :: OutOfRange ) ) } , Varint :: Value ( value ) => FOUR_FLAG | value } ; let mut buffer = [ 0 ; 4 ] ; buffer . as_mut ( ) . put_u32 ( number as u32 ) ; output . write_all ( & buffer ) }
tries to write a varint with a fixed 4-byte representation
tries to write a varint with a fixed 4 - byte representation
varint
Varint
output
&mut T
varint
Varint
output
&mut T