use crate::Document;
use async_trait::async_trait;
use synaptic_core::SynapticError;
use crate::Loader;
#[derive(Debug, Clone)]
pub struct TextLoader {
id: String,
content: String,
}
impl TextLoader {
pub fn new(id: impl Into<String>, content: impl Into<String>) -> Self {
Self {
id: id.into(),
content: content.into(),
}
}
}
#[async_trait]
impl Loader for TextLoader {
async fn load(&self) -> Result<Vec<Document>, SynapticError> {
Ok(vec![Document::new(self.id.clone(), self.content.clone())])
}
}