Adding conditions for serialize_vec_from_table*

This commit is contained in:
Frédéric CAMPO 2025-02-17 22:30:18 +01:00
parent 45c31c23b4
commit 27a9f1cb5c
Signed by: llowin
GPG Key ID: 19EACF0560706F99
2 changed files with 6 additions and 4 deletions

View File

@ -33,13 +33,13 @@ impl EquipementDatabase {
}
impl RecipeDatabase for EquipementDatabase {
fn serialize_vec_from_table<T>(
fn serialize_vec_from_table<T: DeserializeOwned>(
table: &str,
) -> Result<Vec<T>, crate::error::FatalEquipementError> {
todo!()
}
fn serialize_vec_from_table_with_query<T>(
fn serialize_vec_from_table_with_query<T: DeserializeOwned>(
table: &str,
query: &str,
) -> Result<Vec<T>, crate::error::FatalEquipementError> {

View File

@ -7,6 +7,8 @@
use std::{path::Path, rc::Rc};
use serde::de::DeserializeOwned;
use crate::error::{EquipementError, FatalEquipementError};
/// Trait representing a view table
@ -162,12 +164,12 @@ pub trait RecipeDatabase {
Self: std::marker::Sized;
/// Serialize a vector of objects of the given type in the specified table of the underlying database
fn serialize_vec_from_table<T>(
fn serialize_vec_from_table<T: DeserializeOwned>(
table: &str,
) -> std::result::Result<Vec<T>, FatalEquipementError>;
/// Serialize a specified vector of objects of the given type with an additionnal restriction
fn serialize_vec_from_table_with_query<T>(
fn serialize_vec_from_table_with_query<T: DeserializeOwned>(
table: &str,
query: &str,
) -> std::result::Result<Vec<T>, FatalEquipementError>;