mysql_connector/connection/packets/
stmt.rs

1use crate::{error::ProtocolError, Deserialize, ParseBuf};
2
3#[derive(Debug)]
4#[allow(dead_code)]
5pub struct Stmt {
6    pub id: u32,
7    pub columns_len: u16,
8    pub params_len: u16,
9    pub warning_count: u16,
10}
11
12impl Deserialize<'_> for Stmt {
13    const SIZE: Option<usize> = Some(12);
14    type Ctx = ();
15
16    fn deserialize(buf: &mut ParseBuf<'_>, _ctx: Self::Ctx) -> Result<Self, ProtocolError> {
17        buf.check_len(12)?;
18        buf.skip(1);
19        Ok(Self {
20            id: buf.eat_u32(),
21            columns_len: buf.eat_u16(),
22            params_len: buf.eat_u16(),
23            warning_count: {
24                buf.skip(1);
25                buf.eat_u16()
26            },
27        })
28    }
29}