Skip to main content

ToValue

Trait ToValue 

Source
pub trait ToValue {
    // Required method
    fn to_value(&self) -> Value;
}
Expand description

Converts Rust types to Spanner Value.

This trait is used to encode native Rust types into the generic Value representation suitable for transmission to Cloud Spanner (such as in query parameters or mutation values).

Implementations are provided for standard Rust types, mapping them to their appropriate Spanner values. For example, optional types naturally map to Value::Null when they are None.

Required Methods§

Source

fn to_value(&self) -> Value

Encodes this Rust type as a Spanner Value.

Implementations are responsible for using the correct value kind for the corresponding data type in Spanner.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl ToValue for &str

Source§

fn to_value(&self) -> Value

Source§

impl ToValue for Date

Source§

fn to_value(&self) -> Value

Source§

impl ToValue for OffsetDateTime

Source§

fn to_value(&self) -> Value

Source§

impl ToValue for String

Source§

fn to_value(&self) -> Value

Source§

impl ToValue for SystemTime

Source§

fn to_value(&self) -> Value

Source§

impl ToValue for Timestamp

Source§

fn to_value(&self) -> Value

Source§

impl ToValue for Value

Source§

fn to_value(&self) -> Value

Source§

impl ToValue for Vec<u8>

Source§

fn to_value(&self) -> Value

Source§

impl ToValue for bool

Source§

fn to_value(&self) -> Value

Source§

impl ToValue for f32

Source§

fn to_value(&self) -> Value

Source§

impl ToValue for f64

Source§

fn to_value(&self) -> Value

Source§

impl ToValue for i32

Source§

fn to_value(&self) -> Value

Source§

impl ToValue for i64

Source§

fn to_value(&self) -> Value

Source§

impl<T> ToValue for Option<T>
where T: ToValue,

Source§

fn to_value(&self) -> Value

Source§

impl<T> ToValue for Vec<T>
where T: ToValue,

Source§

fn to_value(&self) -> Value

Implementors§

Source§

impl ToValue for Decimal

Source§

impl ToValue for google_cloud_spanner::value::Value