forge_doc/preprocessor/
mod.rs
1use crate::{Comments, Document};
4use alloy_primitives::map::HashMap;
5use std::{fmt::Debug, path::PathBuf};
6
7mod contract_inheritance;
8pub use contract_inheritance::{ContractInheritance, CONTRACT_INHERITANCE_ID};
9
10mod inheritdoc;
11pub use inheritdoc::{Inheritdoc, INHERITDOC_ID};
12
13mod infer_hyperlinks;
14pub use infer_hyperlinks::{InferInlineHyperlinks, INFER_INLINE_HYPERLINKS_ID};
15
16mod git_source;
17pub use git_source::{GitSource, GIT_SOURCE_ID};
18
19mod deployments;
20pub use deployments::{Deployment, Deployments, DEPLOYMENTS_ID};
21
22#[derive(Debug, PartialEq, Eq, Hash)]
24pub struct PreprocessorId(&'static str);
25
26#[derive(Clone, Debug)]
30pub enum PreprocessorOutput {
31 ContractInheritance(HashMap<String, PathBuf>),
34 Inheritdoc(HashMap<String, Comments>),
37 GitSource(String),
40 Deployments(Vec<Deployment>),
43}
44
45pub trait Preprocessor: Debug {
48 fn id(&self) -> PreprocessorId;
51
52 fn preprocess(&self, documents: Vec<Document>) -> Result<Vec<Document>, eyre::Error>;
54}