Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

derivation does not work without importing Template #147

Closed
ubnt-intrepid opened this issue Nov 4, 2018 · 1 comment
Closed

derivation does not work without importing Template #147

ubnt-intrepid opened this issue Nov 4, 2018 · 1 comment

Comments

@ubnt-intrepid
Copy link
Contributor

ubnt-intrepid commented Nov 4, 2018

From Rust 1.30, it is possible to specify the path directly in #[derive()]. Unfortunately, this notation does not work as the derived code assumes that Template is imported at the current module:

extern crate askama;

#[derive(askama::Template)]
#[template(source = "foo", ext = "txt")]
struct Template {}
   Compiling askama1 v0.1.0 (/home/ubnt-intrepid/askama1)
error[E0599]: no method named `render_into` found for type `&Template` in the current scope
 --> src/lib.rs:3:10
  |
3 | #[derive(askama::Template)]
  |          ^^^^^^^^^^^^^^^^
  |
  = help: items from traits can only be used if the trait is in scope
help: the following trait is implemented but not in scope, perhaps add a `use` for it:
  |
4 | use askama::Template;
  |

error: aborting due to previous error

For more information about this error, try `rustc --explain E0599`.
error: Could not compile `askama1`.

To learn more, run the command again with --verbose.
@djc
Copy link
Owner

djc commented Nov 4, 2018

Thanks for fixing this!

@djc djc closed this as completed Nov 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants