Skip to content

Commit

Permalink
Add two inline markers
Browse files Browse the repository at this point in the history
  • Loading branch information
mitsuhiko committed Aug 26, 2024
1 parent 5446f88 commit dfbd604
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions minijinja/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,11 +173,13 @@ impl UndefinedBehavior {
/// If the value is undefined, then iteration fails if the behavior is set to strict,
/// otherwise it succeeds with an empty iteration. This is also internally used in the
/// engine to convert values to lists.
#[inline]
pub(crate) fn try_iter(self, value: Value) -> Result<ValueIter, Error> {
self.assert_iterable(&value).and_then(|_| value.try_iter())
}

/// Are we strict on iteration?
#[inline]
pub(crate) fn assert_iterable(self, value: &Value) -> Result<(), Error> {
if matches!(self, UndefinedBehavior::Strict) && value.is_undefined() {
Err(Error::from(ErrorKind::UndefinedError))
Expand Down

0 comments on commit dfbd604

Please sign in to comment.