diff options
author | Lars Wirzenius <liw@liw.fi> | 2022-11-09 13:16:14 +0200 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2022-11-09 13:22:42 +0200 |
commit | d208687a7c62dfbec0e4941d47db2f897c47a933 (patch) | |
tree | 837cc910b8a9dba0fea20a5cfaf759a4868e24dd | |
parent | e93a903cb50deaf4ae7f9055be4730e1f27e698a (diff) | |
download | riki-d208687a7c62dfbec0e4941d47db2f897c47a933.tar.gz |
add trait for directive implementations
Sponsored-by: author
-rw-r--r-- | src/directive/mod.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/directive/mod.rs b/src/directive/mod.rs index 5bc8ef6..899980d 100644 --- a/src/directive/mod.rs +++ b/src/directive/mod.rs @@ -10,6 +10,14 @@ pub enum Processed { Markdown(String), } +trait DirectiveImplementation { + const REQUIRED: &'static [&'static str]; + const ALLOWED: &'static [&'static str]; + const ALLOW_ANY_UNNAMED: bool; + fn from_parsed(p: &ParsedDirective) -> Self; + fn process(&self, site: &Site, meta: &mut PageMeta) -> Result<String, SiteError>; +} + #[derive(Debug, Eq, PartialEq)] pub enum Directive { Simple, |