Re: [PATCH RESEND v2] rust: regulator: add a bare minimum regulator abstraction

From: Daniel Almeida
Date: Thu Mar 27 2025 - 08:07:53 EST




> On 27 Mar 2025, at 08:50, Danilo Krummrich <dakr@xxxxxxxxxx> wrote:
>
> On Thu, Mar 27, 2025 at 08:46:29AM -0300, Daniel Almeida wrote:
>> Any function that takes 'self' by value (i.e.: “self" instead of “&self” )
>> effectively kills it.
>
> I'm sure Daniel didn't mean it that way, but to avoid confusion, I want to
> clarify that a function that takes `self` as argument not necessarily results in
> `self` being destroyed. It could be moved into some other structure, directly
> returned by the same function etc.
>
> It's just that if the functions lets `self` go out of scope, then it's
> destroyed.
>

True, I found it easier to explain the current code by simplifying the story a
bit to fit the function we are discussing, but what Danilo said is what is
actually correct.

— Daniel