use crate::interner::StringInterner;
use crate::types::DiffResult;
use std::future::Future;
pub trait AsyncGitOps {
type Error: std::error::Error + Send + Sync + 'static;
type DiffFuture<'a>: Future<Output = std::result::Result<DiffResult, Self::Error>> + Send + 'a
where
Self: 'a;
type ResolveShaFuture<'a>: Future<Output = std::result::Result<String, Self::Error>> + Send + 'a
where
Self: 'a;
type SubmodulesFuture<'a>: Future<Output = std::result::Result<Vec<String>, Self::Error>>
+ Send
+ 'a
where
Self: 'a;
fn diff<'a>(
&'a self,
base_sha: &'a str,
head_sha: &'a str,
interner: &'a StringInterner,
diff_filter: &'a str,
) -> Self::DiffFuture<'a>;
fn resolve_sha<'a>(&'a self, reference: &'a str) -> Self::ResolveShaFuture<'a>;
fn submodules<'a>(&'a self) -> Self::SubmodulesFuture<'a>;
}
pub trait AsyncPatternMatcher {
type Error: std::error::Error + Send + Sync + 'static;
type MatchFuture<'a>: Future<Output = std::result::Result<bool, Self::Error>> + Send + 'a
where
Self: 'a;
fn matches<'a>(&'a self, path: &'a str) -> Self::MatchFuture<'a>;
fn matches_sync(&self, path: &str) -> std::result::Result<bool, Self::Error>;
}
pub trait AsyncFileOps {
type Error: std::error::Error + Send + Sync + 'static;
type IsSymlinkFuture<'a>: Future<Output = std::result::Result<bool, Self::Error>> + Send + 'a
where
Self: 'a;
fn is_symlink<'a>(&'a self, path: &'a std::path::Path) -> Self::IsSymlinkFuture<'a>;
fn is_symlink_sync(&self, path: &std::path::Path) -> std::result::Result<bool, Self::Error>;
}