Re: [PATCH v3 4/7] rust: auxiliary: sample: demonstrate ForLt with invariant Mutex type

From: Gary Guo

Date: Thu Jun 25 2026 - 10:38:41 EST


On Fri Jun 19, 2026 at 12:08 AM BST, Danilo Krummrich wrote:
> Extend the auxiliary driver sample to demonstrate both access patterns:
>
> - registration_data() with CovariantForLt!(Data<'_>) for the covariant
> data type that holds a plain &'bound reference.
>
> - registration_data_with() with ForLt!(MutexData<'_>) for an invariant
> data type that wraps a Mutex<&'bound Device>. Since Mutex<T> is
> invariant over T, MutexData cannot implement CovariantForLt and must
> use the closure-based accessor.
>
> Signed-off-by: Danilo Krummrich <dakr@xxxxxxxxxx>

Reviewed-by: Gary Guo <gary@xxxxxxxxxxx>

> ---
> samples/rust/rust_driver_auxiliary.rs | 94 +++++++++++++++++++--------
> 1 file changed, 68 insertions(+), 26 deletions(-)