diff --git a/agdb/src/db/db_value.rs b/agdb/src/db/db_value.rs index 6d9cf607c..19f543e8a 100644 --- a/agdb/src/db/db_value.rs +++ b/agdb/src/db/db_value.rs @@ -468,6 +468,7 @@ impl> From> for DbValue { impl TryFrom for Vec { type Error = DbError; + #[track_caller] fn try_from(value: DbValue) -> Result { Ok(value.bytes()?.clone()) } @@ -476,6 +477,7 @@ impl TryFrom for Vec { impl TryFrom for u64 { type Error = DbError; + #[track_caller] fn try_from(value: DbValue) -> Result { value.to_u64() } @@ -484,6 +486,7 @@ impl TryFrom for u64 { impl TryFrom for u32 { type Error = DbError; + #[track_caller] fn try_from(value: DbValue) -> Result { Ok(value.to_u64()?.try_into()?) } @@ -492,6 +495,7 @@ impl TryFrom for u32 { impl TryFrom for i64 { type Error = DbError; + #[track_caller] fn try_from(value: DbValue) -> Result { value.to_i64() } @@ -500,6 +504,7 @@ impl TryFrom for i64 { impl TryFrom for i32 { type Error = DbError; + #[track_caller] fn try_from(value: DbValue) -> Result { Ok(value.to_i64()?.try_into()?) } @@ -508,6 +513,7 @@ impl TryFrom for i32 { impl TryFrom for f64 { type Error = DbError; + #[track_caller] fn try_from(value: DbValue) -> Result { Ok(value.to_f64()?.to_f64()) } @@ -516,6 +522,7 @@ impl TryFrom for f64 { impl TryFrom for f32 { type Error = DbError; + #[track_caller] fn try_from(value: DbValue) -> Result { Ok(value.to_f64()?.to_f64() as f32) } @@ -524,6 +531,7 @@ impl TryFrom for f32 { impl TryFrom for String { type Error = DbError; + #[track_caller] fn try_from(value: DbValue) -> Result { Ok(value.string()?.clone()) } @@ -532,6 +540,7 @@ impl TryFrom for String { impl TryFrom for bool { type Error = DbError; + #[track_caller] fn try_from(value: DbValue) -> Result { value.to_bool() } @@ -540,6 +549,7 @@ impl TryFrom for bool { impl> TryFrom for Vec { type Error = DbError; + #[track_caller] fn try_from(value: DbValue) -> Result { let db_values: Vec = match value { DbValue::VecI64(v) => Ok(v.into_iter().map(DbValue::from).collect()), diff --git a/agdb_derive/src/lib.rs b/agdb_derive/src/lib.rs index de25dc535..a4aa1e8dd 100644 --- a/agdb_derive/src/lib.rs +++ b/agdb_derive/src/lib.rs @@ -91,20 +91,24 @@ pub fn db_user_value_derive(item: TokenStream) -> TokenStream { }); let tokens = quote! { impl agdb::DbUserValue for #name { + #[track_caller] fn db_id(&self) -> Option { #db_id } + #[track_caller] fn db_keys() -> Vec { vec![#(#db_keys.into()),*] } + #[track_caller] fn from_db_element(element: &agdb::DbElement) -> std::result::Result { Ok(Self { #(#from_db_element),* }) } + #[track_caller] fn to_db_values(&self) -> Vec { vec![#(#db_values),*] } @@ -113,6 +117,7 @@ pub fn db_user_value_derive(item: TokenStream) -> TokenStream { impl TryFrom<&agdb::DbElement> for #name { type Error = agdb::DbError; + #[track_caller] fn try_from(value: &agdb::DbElement) -> std::result::Result { use agdb::DbUserValue; #name::from_db_element(value) @@ -122,6 +127,7 @@ pub fn db_user_value_derive(item: TokenStream) -> TokenStream { impl TryFrom for #name { type Error = agdb::DbError; + #[track_caller] fn try_from(value: agdb::QueryResult) -> std::result::Result { use agdb::DbUserValue; value