Re: [libgpiod][PATCH 1/3] bindings: rust: fix soundness of line_info modeling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri Sep 29, 2023 at 12:39 PM CEST, Viresh Kumar wrote:
> On 28-09-23, 15:24, Erik Schilling wrote:
> > > +/// Line info
> > > +///
> > > +/// This is the owned counterpart to [Info]. Due to a [Deref] implementation,
> > > +/// all functions of [Info] can also be called on this type.
> > > +#[derive(Debug)]
> > > +pub struct InfoOwned {
> > > +    info: *mut gpiod::gpiod_line_info,
> > > +}
> > 
> > While going through all the structs in order to add missing `Send`
> > implementations, it occured to me that it may be a bit confusing if
> > only this one type has the `Owned` suffix, while the others are also
> > "owned" but do not carry that suffix.
> > 
> > Not really sure how to resolve this... We could rename the non-owned
> > `Info` to something like `InfoRef` and turn `InfoOwned` back into
> > `Info`, but reading `&InfoRef` may be a bit weird?
>
> I like this one and none of the others.

OK :). With Manos also agreeing, I will do this then.

>
> > Alternatively, we could rename all other structs to add the suffix...
> > Then, "Owned" would maybe sound confusing - given that no un-owned
> > variant exists.
> > Maybe "Box" would be a more suitable suffix in that case - borrowing
> > from the Box type name [1]?
> > 
> > Any opinions here?
> > 
> > [1] https://doc.rust-lang.org/std/boxed/struct.Box.html





[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux