+
+ pub async fn create_recipe_async(&self, user_id: i64) -> Result<i64> {
+ let self_copy = self.clone();
+ combine_errors(
+ web::block(move || self_copy.create_recipe(user_id).map_err(DBAsyncError::from)).await,
+ )
+ }
+
+ pub async fn set_recipe_title_async(&self, recipe_id: i64, title: &str) -> Result<()> {
+ let self_copy = self.clone();
+ let title_copy = title.to_string();
+ combine_errors(
+ web::block(move || {
+ self_copy
+ .set_recipe_title(recipe_id, &title_copy)
+ .map_err(DBAsyncError::from)
+ })
+ .await,
+ )
+ }
+
+ pub async fn set_recipe_description_async(
+ &self,
+ recipe_id: i64,
+ description: &str,
+ ) -> Result<()> {
+ let self_copy = self.clone();
+ let description_copy = description.to_string();
+ combine_errors(
+ web::block(move || {
+ self_copy
+ .set_recipe_description(recipe_id, &description_copy)
+ .map_err(DBAsyncError::from)
+ })
+ .await,
+ )
+ }
+}