diff options
author | Dirkjan Ochtman <dirkjan@ochtman.nl> | 2017-02-12 20:38:14 +0100 |
---|---|---|
committer | Dirkjan Ochtman <dirkjan@ochtman.nl> | 2017-02-12 20:38:14 +0100 |
commit | c74e9e8971c06ed77eeee79cbac2c4c325b3ffa4 (patch) | |
tree | 3bf410232558d989379681f4593a717118e6bebd /testing/tests | |
parent | 7b831bd79fd1a1b3f6149420b34df1a19644554c (diff) | |
download | askama-c74e9e8971c06ed77eeee79cbac2c4c325b3ffa4.tar.gz askama-c74e9e8971c06ed77eeee79cbac2c4c325b3ffa4.tar.bz2 askama-c74e9e8971c06ed77eeee79cbac2c4c325b3ffa4.zip |
Explicitly pass trait implementation to top-level base template method
This requires a base template struct to be a member of the derived template's
context, but allows the base template to access base template fields.
Diffstat (limited to '')
-rw-r--r-- | testing/tests/inheritance.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/testing/tests/inheritance.rs b/testing/tests/inheritance.rs index 5d5c23c..156358e 100644 --- a/testing/tests/inheritance.rs +++ b/testing/tests/inheritance.rs @@ -10,7 +10,9 @@ struct BaseTemplate { } #[derive(Template)] #[template(path = "child.html")] -struct ChildTemplate { } +struct ChildTemplate { + _parent: BaseTemplate, +} #[test] fn test_use_base_directly() { @@ -20,6 +22,6 @@ fn test_use_base_directly() { #[test] fn test_simple_extends() { - let t = ChildTemplate { }; + let t = ChildTemplate { _parent: BaseTemplate {} }; assert_eq!(t.render(), "Content goes here\nCopyright 2017\n"); } |