summaryrefslogtreecommitdiff
path: root/rust
diff options
context:
space:
mode:
authorMichael Krasnitski <michael.krasnitski@gmail.com>2023-07-17 22:37:25 -0400
committerKyle Martin <krm504@nyu.edu>2023-07-25 20:41:20 -0400
commitc1d1773c23ea73490fbf33dea75e95c7d6ab4c6f (patch)
treede7be709f005a3747737c466ca6d21240b615aa8 /rust
parentdaaad1300e150b292879b10f9e42356440b75d4d (diff)
rust: Add `StructureBuilder::with_members`
Diffstat (limited to 'rust')
-rw-r--r--rust/src/types.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/rust/src/types.rs b/rust/src/types.rs
index 5d472c88..93d0f233 100644
--- a/rust/src/types.rs
+++ b/rust/src/types.rs
@@ -1782,6 +1782,16 @@ impl StructureBuilder {
self
}
+ pub fn with_members<'a, S: BnStrCompatible, T: Into<Conf<&'a Type>>>(
+ &self,
+ members: impl IntoIterator<Item = (T, S)>,
+ ) -> &Self {
+ for (t, name) in members.into_iter() {
+ self.append(t, name, MemberAccess::NoAccess, MemberScope::NoScope);
+ }
+ self
+ }
+
// Getters
pub fn width(&self) -> u64 {