Trait spanner_rs::ToSpanner [−][src]
pub trait ToSpanner {
fn to_spanner(&self) -> Result<Value, Error>;
fn spanner_type() -> Type
where
Self: Sized;
}Expand description
A trait for Rust types that can be converted to Cloud Spanner values.
Types
The crate provides the following mapping between Cloud Spanner types and Rust types.
| Rust Type | Spanner Type |
|---|---|
bool | Bool |
u8, i8, u16, i16, u32, i32, i64 | Int64 |
f64 | Float64 |
&str, String | String |
bigdecimal::BigDecimal | Numeric |
&[u8], Bytes | Bytes |
Nullability
ToSpanner is implemented for Option<T> when T implements ToSpanner.
Option<T> represents a nullable Spanner value.
Arrays
ToSpanner is implemented for Vec<T> when T implements ToSpanner.
Such values map to Spanner’s Array type.
Arrays may contain null values (i.e.: Vec<Option<T>>). Note that Vec<Vec<T>> is not allowed.
Required methods
fn to_spanner(&self) -> Result<Value, Error>
fn to_spanner(&self) -> Result<Value, Error>
Creates a new Cloud Spanner value from this value.
fn spanner_type() -> Type where
Self: Sized,
fn spanner_type() -> Type where
Self: Sized,
Returns the Cloud Spanner Type that this implementation produces.