//! Types and traits related to deserializing values from the database. use crate::{backend::Backend, types::HasSqlType}; // TODO: Allow from_sql to return an error (that can be unified) pub trait FromSql { fn from_sql(raw: Option<&[u8]>) -> Self; } impl FromSql for Option where DB: Backend + HasSqlType, T: FromSql, { fn from_sql(raw: Option<&[u8]>) -> Self { Some(T::from_sql(Some(raw?))) } }