pub fn decode(tag: u8, buffer: &[u8]) -> Result<Self> {
        log::trace!("Receives frontend tag = {:?}, buffer = {:?}", char::from(tag), buffer);

        let cursor = Cursor::from(buffer);
        match tag {
            // Simple query flow.
            QUERY => decode_query(cursor),

            // Extended query flow.
            BIND => decode_bind(cursor),
            CLOSE => decode_close(cursor),
            DESCRIBE => decode_describe(cursor),
            EXECUTE => decode_execute(cursor),
            FLUSH => decode_flush(cursor),
            PARSE => decode_parse(cursor),
            SYNC => decode_sync(cursor),

            TERMINATE => decode_terminate(cursor),

            // Invalid.
            _ => {
                log::error!("unsupported frontend message tag {}", tag);
                Err(Error::UnsupportedFrontendMessage)
            }
        }
    }
/// decodes buffer data to a frontend message
decodes buffer data to a frontend message
decodes buffer data to a frontend message
pub fn decode(tag: u8, buffer: &[u8]) -> Result<Self> {
        log::trace!("Receives frontend tag = {:?}, buffer = {:?}", char::from(tag), buffer);
        let cursor = Cursor::from(buffer);
        match tag {
            // Simple query flow.
            QUERY => decode_query(cursor),
            // Extended query flow.
            BIND => decode_bind(cursor),
            CLOSE => decode_close(cursor),
            DESCRIBE => decode_describe(cursor),
            EXECUTE => decode_execute(cursor),
            FLUSH => decode_flush(cursor),
            PARSE => decode_parse(cursor),
            SYNC => decode_sync(cursor),
            TERMINATE => decode_terminate(cursor),
            // Invalid.
            _ => {
                log::error!("unsupported frontend message tag {}", tag);
                Err(Error::UnsupportedFrontendMessage)
            }
        }
    }
pub fn decode ( tag : u8 , buffer : & [ u8 ] ) -> Result < Self > { log :: trace ! ( " " char from ( tag ) buffer ) ; let cursor = Cursor :: from ( buffer ) ; match tag { // Simple query flow. QUERY => decode_query ( cursor ) , // Extended query flow. BIND => decode_bind ( cursor ) , CLOSE => decode_close ( cursor ) , DESCRIBE => decode_describe ( cursor ) , EXECUTE => decode_execute ( cursor ) , FLUSH => decode_flush ( cursor ) , PARSE => decode_parse ( cursor ) , SYNC => decode_sync ( cursor ) , TERMINATE => decode_terminate ( cursor ) , // Invalid. _ => { log :: error ! ( " " tag ) ; Err ( Error :: UnsupportedFrontendMessage ) } } }
decodes buffer data to a frontend message
decodes buffer data to a frontend message
tag
u8
buffer
&[u8]
tag
u8
buffer
&[u8]