Was this page helpful?
Data Types¶
The driver maps database data types to matching Rust types to achieve seamless sending and receiving of CQL values.
See the following chapters for examples on how to send and receive each data type.
See Statement values for more information about sending values along with statements.
See Query result for more information about retrieving values from queries
Database types and their Rust equivalents:
Boolean<—->boolTinyint<—->i8Smallint<—->i16Int<—->i32BigInt<—->i64Float<—->f32Double<—->f64Ascii,Text,Varchar<—->&str,String,Box<str>,Arc<str>Counter<—->value::CounterBlob<—->&[u8],Vec<u8>,Bytes, (and[u8; N]for serialization only)Inet<—->std::net::IpAddrUuid<—->uuid::UuidTimeuuid<—->value::CqlTimeuuidDate<—->value::CqlDate,chrono::NaiveDate,time::DateTime<—->value::CqlTime,chrono::NaiveTime,time::TimeTimestamp<—->value::CqlTimestamp,chrono::DateTime<Utc>,time::OffsetDateTimeDuration<—->value::CqlDurationDecimal<—->value::CqlDecimal,bigdecimal::DecimalVarint<—->value::CqlVarint,num_bigint::BigInt(v0.3 and v0.4)List<—->Vec<T>Set<—->Vec<T>Map<—->std::collections::HashMap<K, V>Tuple<—-> Rust tuplesUDT (User defined type)<—-> Custom user structs with macrosVector<—->Vec<T>
Additionally, Box and Arc serialization and deserialization is supported for all above types.