pub trait FromValue: Sized {
// Required method
fn from_value(value: &Value, type_: &Type) -> Result<Self, ConvertError>;
}Expand description
Converts a Spanner Value into a Rust type.
Implementations are provided for all standard types like String, primitive integer
and float types, decimals, timestamps, dates, vectors, and options for nullable fields.
Required Methods§
Sourcefn from_value(value: &Value, type_: &Type) -> Result<Self, ConvertError>
fn from_value(value: &Value, type_: &Type) -> Result<Self, ConvertError>
Converts a Spanner value into the target Rust type, using the provided
Spanner Type metadata for compatibility checks.
§Errors
Returns a ConvertError if the kind of the value does not match the expected kind,
if the value is null but the target type is not optional (e.g., Option<T>), or if
parsing or decoding the inner value format fails.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".