[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0c4e5168-49f8-409c-a6f2-ae5e9df29ded@foxido.dev>
Date: Tue, 23 Dec 2025 18:02:57 +0300
From: Gladyshev Ilya <foxido@...ido.dev>
To: Danilo Krummrich <dakr@...nel.org>
Cc: "Rafael J. Wysocki" <rafael@...nel.org>, Len Brown <lenb@...nel.org>,
Miguel Ojeda <ojeda@...nel.org>, Boqun Feng <boqun.feng@...il.com>,
Gary Guo <gary@...yguo.net>, Björn Roy Baron
<bjorn3_gh@...tonmail.com>, Benno Lossin <lossin@...nel.org>,
Andreas Hindborg <a.hindborg@...nel.org>, Alice Ryhl <aliceryhl@...gle.com>,
Trevor Gross <tmgross@...ch.edu>, Tamir Duberstein <tamird@...il.com>,
Armin Wolf <W_Armin@....de>, platform-driver-x86@...r.kernel.org,
linux-kernel@...r.kernel.org, rust-for-linux@...r.kernel.org,
linux-acpi@...r.kernel.org
Subject: Re: [RFC PATCH 1/3] rust: implement wrapper for acpi_object
On 12/23/25 01:44, Danilo Krummrich wrote:
> On Mon Dec 22, 2025 at 10:47 PM CET, Gladyshev Ilya wrote:
>> I couldn't really decide between implementing all types or only the one
>> needed... Probably, I should provide simple implementations for all the
>> others, I will fix that.
>
> If they are not needed by any of the drivers you're aiming at, you should
> probably just drop them.
Ack.
>> Wouldn't it be confusing to overload Deref on a non "pointer-like" type
>> just for an implicit cast?
>
> What do you mean with overload Deref? What I mean is
>
> impl Deref for AcpiBuffer {
> type Target = [u8];
>
> [...]
> }
I meant the same, just used strange terminology, sorry. If I understand
it correctly, Deref trait gives you "overloaded" dereference operator as
well as implicit coercion in many cases, and I don't know if I want them.
Personally, I prefer the explicit style like:
```
let a: &AcpiInteger = /* ... */;
call_func(/* u64: */ a.val())
```
rather than:
```
let a: &AcpiInteger = /* ... */;
call_func(/* u64: */ *a)
```
The former feels clearer to me; the latter gives me "smart pointer"
vibes and feels a bit confusing, because there are no smart pointers.
That said, I'm not a Rust expert at all -- so if you believe this change
is better, I'll implement it your way.
Powered by blists - more mailing lists