bun_sql 0.1.0

A Rust-native programmable browser runtime built on Servo and SpiderMonkey
// PORT NOTE: Zig source is a non-exhaustive `enum(u8)` (trailing `_`), meaning
// any u8 value is a valid PacketType. A Rust `#[repr(u8)] enum` would make
// unlisted values UB on transmute, so this is ported as a transparent u8
// newtype with associated consts instead.
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq, Hash)]
pub struct PacketType(pub u8);

impl PacketType {
    // Server packets
    pub const OK: Self = Self(0x00);
    pub const EOF: Self = Self(0xfe);
    pub const ERROR: Self = Self(0xff);
    pub const LOCAL_INFILE: Self = Self(0xfb);

    // Client/server packets
    pub const HANDSHAKE: Self = Self(0x0a);
    pub const MORE_DATA: Self = Self(0x01);

    pub const AUTH_SWITCH: u8 = 0xfe;
}

// ported from: src/sql/mysql/protocol/PacketType.zig