blob: 934975f060465ef7d654b9ecfc01199b2bd129d6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
mod latex_import;
mod latex_include;
use self::{latex_import::LatexImportLinkProvider, latex_include::LatexIncludeLinkProvider};
use crate::{
feature::{ConcatProvider, FeatureProvider, FeatureRequest},
protocol::{DocumentLink, DocumentLinkParams},
};
use async_trait::async_trait;
pub struct LinkProvider {
provider: ConcatProvider<DocumentLinkParams, DocumentLink>,
}
impl LinkProvider {
pub fn new() -> Self {
Self {
provider: ConcatProvider::new(vec![
Box::new(LatexImportLinkProvider),
Box::new(LatexIncludeLinkProvider),
]),
}
}
}
impl Default for LinkProvider {
fn default() -> Self {
Self::new()
}
}
#[async_trait]
impl FeatureProvider for LinkProvider {
type Params = DocumentLinkParams;
type Output = Vec<DocumentLink>;
async fn execute<'a>(&'a self, req: &'a FeatureRequest<Self::Params>) -> Self::Output {
self.provider.execute(req).await
}
}
|