[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <DAWUNZ33A0DJ.1RCZSO3S0Q1JB@kernel.org>
Date: Fri, 27 Jun 2025 01:22:45 +0200
From: "Benno Lossin" <lossin@...nel.org>
To: "Danilo Krummrich" <dakr@...nel.org>, <gregkh@...uxfoundation.org>,
<rafael@...nel.org>, <ojeda@...nel.org>, <alex.gaynor@...il.com>,
<boqun.feng@...il.com>, <gary@...yguo.net>, <bjorn3_gh@...tonmail.com>,
<a.hindborg@...nel.org>, <aliceryhl@...gle.com>, <tmgross@...ch.edu>,
<david.m.ertman@...el.com>, <ira.weiny@...el.com>, <leon@...nel.org>,
<kwilczynski@...nel.org>, <bhelgaas@...gle.com>
Cc: <rust-for-linux@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<linux-pci@...r.kernel.org>
Subject: Re: [PATCH v4 4/5] rust: types: ForeignOwnable: Add type Target
On Thu Jun 26, 2025 at 10:00 PM CEST, Danilo Krummrich wrote:
> ForeignOwnable::Target defines the payload data of a ForeignOwnable. For
> Arc<T> for instance, ForeignOwnable::Target would just be T.
>
> This is useful for cases where a trait bound is required on the target
> type of the ForeignOwnable. For instance:
>
> fn example<P>(data: P)
> where
> P: ForeignOwnable,
> P::Target: MyTrait,
> {}
>
> Suggested-by: Benno Lossin <lossin@...nel.org>
> Signed-off-by: Danilo Krummrich <dakr@...nel.org>
Reviewed-by: Benno Lossin <lossin@...nel.org>
We might also be able to add a `Deref<Target = Self::Target>` bound on
`Borrowed` and `BorrowedMut`, but we should only do that when necessary.
---
Cheers,
Benno
> ---
> rust/kernel/alloc/kbox.rs | 2 ++
> rust/kernel/sync/arc.rs | 1 +
> rust/kernel/types.rs | 4 ++++
> 3 files changed, 7 insertions(+)
Powered by blists - more mailing lists