Re: [PATCH V6 3/8] libgpiod: Add rust wrapper crate

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

 



On Mon, Oct 17, 2022 at 04:56:25PM +0530, Viresh Kumar wrote:
> On 15-10-22, 00:06, Kent Gibson wrote:
> > If the mutators for each field still exist they may as well be pub.
> > 
> > And they should return Result<&mut Self> so they can be chained, as you
> > suggest.
> > 
> > Wrt the values param (which I would prefer was called props)
> 
> Is this fine now ? Rebased over v7.
> 
> diff --git a/bindings/rust/libgpiod/src/line_settings.rs b/bindings/rust/libgpiod/src/line_settings.rs
> index 2c3090132ea5..be50b5b41c5a 100644
> --- a/bindings/rust/libgpiod/src/line_settings.rs
> +++ b/bindings/rust/libgpiod/src/line_settings.rs
> @@ -70,18 +70,18 @@ impl Settings {
>      }
> 
>      /// Set line prop setting.
> -    pub fn set_prop(&mut self, values: &[SettingVal]) -> Result<()> {
> -        for value in values {
> -            match value {
> -                SettingVal::Direction(val) => self.set_direction(*val)?,
> -                SettingVal::EdgeDetection(val) => self.set_edge_detection(*val)?,
> -                SettingVal::Bias(val) => self.set_bias(*val)?,
> -                SettingVal::Drive(val) => self.set_drive(*val)?,
> -                SettingVal::ActiveLow(val) => self.set_active_low(*val),
> -                SettingVal::DebouncePeriod(val) => self.set_debounce_period(*val),
> -                SettingVal::EventClock(val) => self.set_event_clock(*val)?,
> -                SettingVal::OutputValue(val) => self.set_output_value(*val)?,
> -            }
> +    pub fn set_prop(&mut self, props: &[SettingVal]) -> Result<()> {
                                                                  ^   
                                                        also &mut Self

Apart from that, yeah that is what I had in mind, as also noted in my
forthcoming v7 review.

Cheers,
Kent.




[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