Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Part of #95 Before test bench_parse_template ... bench: 27,407 ns/iter (+/- 11,395) test bench_parse_text ... bench: 638 ns/iter (+/- 46) test bench_parse_variable ... bench: 2,479 ns/iter (+/- 212) test bench_render_template ... bench: 8,046 ns/iter (+/- 2,514) test bench_render_text ... bench: 344 ns/iter (+/- 23) test bench_render_variable ... bench: 1,578 ns/iter (+/- 243) After test bench_parse_template ... bench: 26,348 ns/iter (+/- 4,703) test bench_parse_text ... bench: 653 ns/iter (+/- 169) test bench_parse_variable ... bench: 2,647 ns/iter (+/- 187) test bench_render_template ... bench: 6,898 ns/iter (+/- 1,526) test bench_render_text ... bench: 276 ns/iter (+/- 28) test bench_render_variable ... bench: 418 ns/iter (+/- 29) BREAKING CHANGE: `Context` now works with a `&dyn Globals` instead of an `Object`.
- Loading branch information
Showing
4 changed files
with
63 additions
and
24 deletions.
There are no files selected for viewing
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,14 @@ | ||
use std::fmt; | ||
|
||
use value::Object; | ||
use value::Value; | ||
|
||
pub trait Globals: fmt::Debug { | ||
fn get<'a>(&'a self, name: &str) -> Option<&'a Value>; | ||
} | ||
|
||
impl Globals for Object { | ||
fn get<'a>(&'a self, name: &str) -> Option<&'a Value> { | ||
self.get(name) | ||
} | ||
} |
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