Re: [PATCH 2/4] rust: alloc: implement `Borrow` and `BorrowMut` for `Arc` types

From: Benno Lossin
Date: Sun Jun 01 2025 - 12:17:18 EST


On Sun Jun 1, 2025 at 5:00 AM CEST, Alexandre Courbot wrote:
> Implement these two common traits, which allow generic types to store
> either an owned value or a reference to it, leveraging the `Deref`
> implementation.

Same here.

---
Cheers,
Benno

>
> `Arc` can only implement `Borrow`, but `UniqueArc` is able to support
> both.
>
> `ForeignOwnable` makes a call to its own `borrow` method which must be
> disambiguated.
>
> Signed-off-by: Alexandre Courbot <acourbot@xxxxxxxxxx>
> ---
> rust/kernel/sync/arc.rs | 21 ++++++++++++++++++++-
> 1 file changed, 20 insertions(+), 1 deletion(-)