fn new()

in propfuzz-macro/src/propfuzz_impl.rs [182:211]


    fn new(sig: &'a Signature, block: &'a Block) -> Result<Self> {
        if sig.inputs.is_empty() {
            return Err(Error::new_spanned(
                sig,
                "#[propfuzz] requires at least one argument",
            ));
        }

        let mut errors = ErrorList::new();

        let params = sig
            .inputs
            .iter()
            .filter_map(|param| match param {
                FnArg::Receiver(receiver) => {
                    errors.combine(Error::new_spanned(
                        receiver,
                        "#[propfuzz] is only supported on top-level functions",
                    ));
                    None
                }
                FnArg::Typed(param) => errors.combine_opt(|| PropfuzzParam::new(param)),
            })
            .collect::<Vec<_>>();

        // If there are any errors, return them.
        errors.finish()?;

        Ok(Self { params, block })
    }