Re: [PATCH v3 4/7] rust: auxiliary: sample: demonstrate ForLt with invariant Mutex type
"Gary Guo" <[email protected]>
| Newsgroups | dev.linux.lists.nova-gpu,dev.linux.lists.driver-core,org.freedesktop.lists.dri-devel,org.kernel.vger.linux-kernel,org.kernel.vger.linux-pwm,org.kernel.vger.rust-for-linux |
|---|---|
| Message-ID | <[email protected]> |
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 <[email protected]> Reviewed-by: Gary Guo <[email protected]> > --- > samples/rust/rust_driver_auxiliary.rs | 94 +++++++++++++++++++-------- > 1 file changed, 68 insertions(+), 26 deletions(-)