Skip to main content

ToType

Trait ToType 

Source
pub trait ToType {
    // Required method
    fn to_type() -> Type;
}
Expand description

Trait for mapping Rust primitive types to ClickHouse types Equivalent to C++ Type::CreateSimple<T>() template specializations

This trait allows type inference in column constructors, eliminating the need to pass Type explicitly when creating typed columns.

§Examples

use clickhouse_native_client::types::{Type, ToType};

assert_eq!(i32::to_type(), Type::int32());
assert_eq!(u64::to_type(), Type::uint64());
assert_eq!(f64::to_type(), Type::float64());

Required Methods§

Source

fn to_type() -> Type

Returns the corresponding ClickHouse Type for this Rust type.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl ToType for f32

Source§

impl ToType for f64

Source§

impl ToType for i8

Source§

impl ToType for i16

Source§

impl ToType for i32

Source§

impl ToType for i64

Source§

impl ToType for i128

Source§

impl ToType for u8

Source§

impl ToType for u16

Source§

impl ToType for u32

Source§

impl ToType for u64

Source§

impl ToType for u128

Implementors§