Re: [PATCH] rust: module_param: return copy from value() for Copy types

From: Alice Ryhl

Date: Mon Mar 23 2026 - 08:53:33 EST


On Mon, Mar 23, 2026 at 1:48 PM Andreas Hindborg <a.hindborg@xxxxxxxxxx> wrote:
>
> Rename the existing `value()` method to `value_ref()` which returns a
> shared reference to the parameter value, and add a new `value()`
> method on `ModuleParamAccess<T>` where `T: Copy` that returns the
> value by copy.
>
> This provides a more ergonomic API for the common case where the
> parameter type implements `Copy`, avoiding the need to explicitly
> dereference the return value at call sites.
>
> Currently `value_ref()` has no in-tree callers, but it will be needed
> when support for non-`Copy` parameter types such as arrays and
> strings is added.
>
> Signed-off-by: Andreas Hindborg <a.hindborg@xxxxxxxxxx>

Reviewed-by: Alice Ryhl <aliceryhl@xxxxxxxxxx>