use std::future::Future; use std::pin::Pin; use gix_hash::ObjectId; use jacquard_common::deps::smol_str::SmolStr; use jacquard_common::types::did::Did; pub type SourceFuture<'a, T> = Pin + Send + 'a>>; pub trait LanguageSource: Send + Sync { fn page<'a>( &'a self, cursor: Option<&'a str>, limit: usize, ) -> SourceFuture<'a, Result>; fn languages<'a>(&'a self, repo: &'a Did, commit: ObjectId) -> SourceFuture<'a, Fetched>; } #[derive(Debug, Default)] pub struct Page { pub repos: Vec, pub cursor: Option, } #[derive(Debug)] pub struct IndexedRepo { pub repo: Did, pub commit: ObjectId, pub languages: Vec<(SmolStr, i64)>, } #[derive(Debug)] pub enum Fetched { Languages(Vec<(SmolStr, i64)>), NotReady(SmolStr), Failed(String), }