Skip to main content

check_rng_guard_params

Function check_rng_guard_params 

Source
pub(crate) fn check_rng_guard_params(
    inputs: &Punctuated<FnArg, Comma>,
    rng: bool,
    has_options: impl Fn(&str) -> bool,
) -> Result<()>
Expand description

Check the RNG guard parameters of a signature (#2002): &RngGuard is filled by a #[miniextendr(rng)] wrapper (rng) with the guard it holds, so it needs rng, takes no per-parameter option (has_options, keyed by Rust name: it is no R argument) and appears at most once. Any other shape that names RngGuard (&mut RngGuard, by value, inside another type) is refused: the wrapper lends its guard for the call.

Shared by standalone functions (lib.rs) and inherent methods (ParsedMethod::from_impl_item). Every error points at the parameter.