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

From: Mark Brown
Date: Thu Mar 27 2025 - 07:43:58 EST


On Thu, Mar 27, 2025 at 12:36:23PM +0100, Maud Spierings wrote:
> On 3/27/25 12:32, Mark Brown wrote:

> > My understanding was that the enable was done by transforming a
> > Regulator into an EnabledRegulator but if you can explicitly call
> > disable() on an EnabledRegulator without destroying it then you've got
> > an EnabledRegulator which isn't actually enabled. Perhaps it's not
> > clear to me how the API should work?

> From my understanding, disable() takes ownership of self, it does not take a
> reference, so the EnabledRegulator is consumed and the Regulator is returned
> through the result. So EnabledRegulator will get dropped in this function
> which owns it.

Ah, OK - if the disable() takes ownership of the passed object that's
fine.

Attachment: signature.asc
Description: PGP signature