# 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. Please note that using some of those types requires enabling respective feature flags. Details are available in chapters for such data types.

See [Statement values](https://rust-driver.docs.scylladb.com/v1.5.0/statements/values.md) for more information about sending values along with statements.<br />
\\\\
See [Query result](https://rust-driver.docs.scylladb.com/v1.5.0/statements/result.md) for more information about retrieving values from queries

Database types and their Rust equivalents:

* `Boolean` <—-> `bool`
* `Tinyint`  <—->  `i8`
* `Smallint` <—-> `i16`
* `Int` <—-> `i32`
* `BigInt` <—-> `i64`
* `Float` <—-> `f32`
* `Double` <—-> `f64`
* `Ascii`, `Text`, `Varchar` <—-> `&str`, `String`, `Box<str>`, `Arc<str>`
* `Counter` <—-> `value::Counter`
* `Blob` <—-> `&[u8]`, `Vec<u8>`, `Bytes`, (and `[u8; N]` for serialization only)
* `Inet` <—-> `std::net::IpAddr`
* `Uuid` <—-> `uuid::Uuid`
* `Timeuuid` <—-> `value::CqlTimeuuid`
* `Date` <—-> `value::CqlDate`, `chrono::NaiveDate`, `time::Date`
* `Time` <—-> `value::CqlTime`, `chrono::NaiveTime`, `time::Time`
* `Timestamp` <—-> `value::CqlTimestamp`, `chrono::DateTime<Utc>`, `time::OffsetDateTime`
* `Duration` <—-> `value::CqlDuration`
* `Decimal` <—-> `value::CqlDecimal`, `value::CqlDecimalBorrowed`, `bigdecimal::BigDecimal`
* `Varint` <—-> `value::CqlVarint`, `value::CqlVarintBorrowed`, `num_bigint::BigInt` (v0.3 and v0.4)
* `List` <—-> `Vec<T>`
* `Set` <—-> `Vec<T>`
* `Map` <—-> `std::collections::HashMap<K, V>`
* `Tuple` <—-> Rust tuples
* `UDT (User defined type)` <—-> Custom user structs with macros
* `Vector` <—-> `Vec<T>`

Additionally, `Box`, `Arc`, and `Cow` serialization and deserialization is supported for all above types.
