From 94e2d1b1223735ccb3804e1c22855ba93062cdb4 Mon Sep 17 00:00:00 2001 From: Georgios Konstantopoulos Date: Tue, 1 Mar 2022 14:39:30 +0200 Subject: [PATCH] feat(abigen): add helper for getting number of abigen'd contracts --- ethers-contract/ethers-contract-abigen/src/multi.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ethers-contract/ethers-contract-abigen/src/multi.rs b/ethers-contract/ethers-contract-abigen/src/multi.rs index bb9a12f7..7d35eef5 100644 --- a/ethers-contract/ethers-contract-abigen/src/multi.rs +++ b/ethers-contract/ethers-contract-abigen/src/multi.rs @@ -309,6 +309,16 @@ pub struct MultiBindings { } impl MultiBindings { + /// Returns the number of contracts to generate bindings for. + pub fn len(&self) -> usize { + self.expansion.contracts.len() + } + + /// Returns whether there are any bindings to be generated + pub fn is_empty(&self) -> bool { + self.expansion.contracts.is_empty() + } + fn into_inner(self, single_file: bool) -> MultiBindingsInner { self.expansion.into_bindings(single_file, self.rustfmt) }