use crate::{
client::ModelLister,
model::{Model, ModelList, ModelListingError},
wasm_compat::WasmCompatSend,
};
pub struct MockModelLister {
models: Vec<Model>,
}
impl MockModelLister {
pub fn new(models: Vec<Model>) -> Self {
Self { models }
}
}
impl ModelLister for MockModelLister {
type Client = Vec<Model>;
fn new(client: Self::Client) -> Self {
Self { models: client }
}
fn list_all(
&self,
) -> impl std::future::Future<Output = Result<ModelList, ModelListingError>> + WasmCompatSend
{
let models = self.models.clone();
async move { Ok(ModelList::new(models)) }
}
}