The library intentionally rejects conversions that could silently lose data. For example, reading a BIGINT column as i8 will return an error rather than truncating the value. This ensures data integrity and makes bugs easier to catch.
Widening conversions (e.g., reading TINYINT as i64) are allowed.
Rust Type MySQL Type Notes
boolTINYINTEncoded as 0 or 1
i8TINYINT
i16SMALLINT
i32INT
i64BIGINT
u8TINYINT UNSIGNED
u16SMALLINT UNSIGNED
u32INT UNSIGNED
u64BIGINT UNSIGNED
f32FLOAT
f64DOUBLE
&strVARCHAR
StringVARCHAR
&[u8]BLOB
Vec<u8>BLOB
Option<T>Same as T None encodes as NULL
Signed and unsigned types are strictly separated. You cannot decode a signed column (e.g., TINYINT) to an unsigned Rust type (e.g., u8), or vice versa.
MySQL Type Rust Types
TINYINTi8, i16, i32, i64, bool
SMALLINTi16, i32, i64
MEDIUMINT, INTi32, i64
BIGINTi64
TINYINT UNSIGNEDu8, u16, u32, u64, bool
SMALLINT UNSIGNEDu16, u32, u64
MEDIUMINT UNSIGNED, INT UNSIGNEDu32, u64
BIGINT UNSIGNEDu64
FLOATf32, f64
DOUBLEf64
VARCHAR, CHAR, TEXT, etc.&str, String
BLOB, BINARY, VARBINARY, etc.&[u8], Vec<u8>
NULLOption<T>
Date/time types are exposed through the Value enum:
MySQL Type Value Variants
DATEDate0, Date4
DATETIME, TIMESTAMPDatetime0, Datetime4, Datetime7, Datetime11
TIMETime0, Time8, Time12
The numeric suffix indicates the wire format byte length.
DECIMAL and NUMERIC columns are returned as Value::Byte containing the string representation.
Additional type support is available through feature flags.
Rust Type MySQL Type Notes
uuid::UuidVARCHAR(36)Encoded as hyphenated string
MySQL Type Rust Type Notes
VARCHAR, CHARuuid::UuidParsed from hyphenated string
BINARY(16)uuid::UuidParsed from 16 bytes
Rust Type MySQL Type
chrono::NaiveDateDATE
chrono::NaiveTimeTIME
chrono::NaiveDateTimeDATETIME
MySQL Type Rust Type Notes
DATEchrono::NaiveDateZero dates (0000-00-00) return an error
TIMEchrono::NaiveTimeNegative times or times with days return an error
DATETIME, TIMESTAMPchrono::NaiveDateTimeZero datetimes return an error
Rust Type MySQL Type
time::DateDATE
time::TimeTIME
time::PrimitiveDateTimeDATETIME
MySQL Type Rust Type Notes
DATEtime::DateZero dates return an error
TIMEtime::TimeNegative times or times with days return an error
DATETIME, TIMESTAMPtime::PrimitiveDateTimeZero datetimes return an error
Rust Type MySQL Type
rust_decimal::DecimalDECIMAL
MySQL Type Rust Type Notes
DECIMALrust_decimal::Decimal96-bit precision, not arbitrary like MySQL