rusticx-core 1.0.0

Core traits, types, and abstractions for the Rusticx multi-database ORM
Documentation
1
2
3
4
5
6
7
8
/// Convert a `Value` into a concrete Rust type via serde round-trip.
/// Used by the `#[derive(Model)]` macro-generated `from_row` implementations.
use crate::value::Value;

pub fn from_value<T: serde::de::DeserializeOwned>(val: Value) -> Result<T, serde_json::Error> {
    let json = serde_json::to_value(&val)?;
    serde_json::from_value(json)
}