From: "Max R. Carrara" <m.carrara@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH perlmod 1/4] ffi: implement ExactSizeIterator for StackIter
Date: Mon, 20 Jul 2026 17:25:37 +0200 [thread overview]
Message-ID: <20260720152541.524463-2-m.carrara@proxmox.com> (raw)
In-Reply-To: <20260720152541.524463-1-m.carrara@proxmox.com>
Since we know how many remaining values there are on the stack, we can
confidently implement `ExactSizeIterator` on `StackIter`.
Signed-off-by: Max R. Carrara <m.carrara@proxmox.com>
---
perlmod/src/ffi.rs | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/perlmod/src/ffi.rs b/perlmod/src/ffi.rs
index 1c68518..1b1066d 100644
--- a/perlmod/src/ffi.rs
+++ b/perlmod/src/ffi.rs
@@ -468,8 +468,15 @@ impl Iterator for StackIter {
}
}
}
+
+ fn size_hint(&self) -> (usize, Option<usize>) {
+ let remaining = self.end - self.at;
+ (remaining, Some(remaining))
+ }
}
+impl ExactSizeIterator for StackIter {}
+
/// Pop the current argument marker off of the argument marker stack.
///
/// # Safety
--
2.47.3
next prev parent reply other threads:[~2026-07-20 15:25 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-20 15:25 [PATCH perlmod 0/4] perlmod: add #[hash] parameter Max R. Carrara
2026-07-20 15:25 ` Max R. Carrara [this message]
2026-07-20 15:25 ` [PATCH perlmod 2/4] value: implement serde::de::IntoDeserializer on Value Max R. Carrara
2026-07-20 15:25 ` [PATCH perlmod 3/4] perlmod, macro: add #[hash] parameter Max R. Carrara
2026-07-20 15:25 ` [PATCH perlmod 4/4] testlib: run perltidy Max R. Carrara
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260720152541.524463-2-m.carrara@proxmox.com \
--to=m.carrara@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox