-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cf50b0c
commit 3c0024e
Showing
10 changed files
with
180 additions
and
30 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
output.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
pub struct TDoc<'a> { | ||
pub name: &'a str, | ||
pub definitions: indexmap::IndexMap<String, fastn_resolved::Definition>, | ||
pub builtins: &'static indexmap::IndexMap<String, fastn_resolved::Definition>, | ||
} | ||
|
||
impl TDoc<'_> { | ||
fn get(&self, name: &str) -> Option<&fastn_resolved::Definition> { | ||
if let Some(definition) = self.definitions.get(name) { | ||
return Some(definition); | ||
} | ||
|
||
if let Some(definition) = self.builtins.get(name) { | ||
return Some(definition); | ||
} | ||
|
||
None | ||
} | ||
} | ||
|
||
impl<'a> fastn_resolved::tdoc::TDoc for TDoc<'a> { | ||
fn get_opt_function(&self, name: &str) -> Option<fastn_resolved::Function> { | ||
match self.get(name) { | ||
Some(fastn_resolved::Definition::Function(f)) => Some(f.clone()), | ||
_ => None, | ||
} | ||
} | ||
|
||
fn get_opt_record(&self, name: &str) -> Option<fastn_resolved::Record> { | ||
match self.get(name) { | ||
Some(fastn_resolved::Definition::Record(f)) => Some(f.clone()), | ||
_ => None, | ||
} | ||
} | ||
|
||
fn name(&self) -> &str { | ||
self.name | ||
} | ||
|
||
fn get_opt_component(&self, name: &str) -> Option<fastn_resolved::ComponentDefinition> { | ||
match self.get(name) { | ||
Some(fastn_resolved::Definition::Component(f)) => Some(f.clone()), | ||
_ => None, | ||
} | ||
} | ||
|
||
fn get_opt_web_component(&self, name: &str) -> Option<fastn_resolved::WebComponentDefinition> { | ||
match self.get(name) { | ||
Some(fastn_resolved::Definition::WebComponent(f)) => Some(f.clone()), | ||
_ => None, | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters