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

Better documentation and iteration interface for value #132

Merged
merged 2 commits into from Oct 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions minijinja/src/filters.rs
Expand Up @@ -636,7 +636,7 @@ mod builtins {
if count == 0 {
return Err(Error::new(ErrorKind::InvalidOperation, "count cannot be 0"));
}
let items = ok!(value.try_iter()).collect::<Vec<_>>();
let items = ok!(value.try_iter_owned()).collect::<Vec<_>>();
let len = items.len();
let items_per_slice = len / count;
let slices_with_extra = len % count;
Expand Down Expand Up @@ -688,7 +688,7 @@ mod builtins {
let mut rv = Vec::new();
let mut tmp = Vec::with_capacity(count);

for item in ok!(value.try_iter()) {
for item in ok!(value.try_iter_owned()) {
if tmp.len() == count {
rv.push(Value::from(mem::replace(
&mut tmp,
Expand Down
2 changes: 1 addition & 1 deletion minijinja/src/key/mod.rs
Expand Up @@ -269,7 +269,7 @@ pub mod key_interning {

let v = Value::from_serializable(&vec![m.clone(), m.clone(), m.clone()]);

for value in v.try_iter().unwrap() {
for value in v.try_iter_owned().unwrap() {
match value.0 {
ValueRepr::Map(m, _) => {
let k = m.iter().next().unwrap().0;
Expand Down