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

docs: point to add_template_owned regardless if the feature is enable… #666

Merged
merged 1 commit into from
Jan 5, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions minijinja/src/environment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,14 +138,13 @@ impl<'source> Environment<'source> {
/// let mut env = Environment::new();
/// env.add_template("index.html", "Hello {{ name }}!").unwrap();
/// ```
/// This method fails if the template has a syntax error.
///
/// Note that there are situations where the interface of this method is
/// too restrictive as you need to hold on to the strings for the lifetime
/// of the environment. This methodl fails if the template has a syntax error.
#[cfg_attr(
feature = "loader",
doc = "To address this restriction use [`add_template_owned`](Self::add_template_owned)."
)]
/// of the environment. To avoid this restriction use
/// [`add_template_owned`](Self::add_template_owned), which is available
/// when the `loader` feature is enabled.
pub fn add_template(&mut self, name: &'source str, source: &'source str) -> Result<(), Error> {
self.templates.insert(name, source)
}
Expand Down