On 20-01-23, 10:45, Bartosz Golaszewski wrote: > From: Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxx> > > In C++ bindings we can chain the mutators as they all return a reference > to the object they modify. It's a common practice to allow that in Rust > too so make all mutators that don't already do it return a mutable > reference to self. > > It's also logically incorrect to make mutators borrow an immutable > reference to self. Even if that builds - as we're fiddling with C > pointers - it could change in the future. It's fine for getters but > setters should all use mutable references. > > Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxx> > --- > .../rust/libgpiod/examples/gpio_events.rs | 2 +- > .../examples/gpio_threaded_info_events.rs | 6 +- > bindings/rust/libgpiod/examples/gpioget.rs | 4 +- > bindings/rust/libgpiod/examples/gpiomon.rs | 2 +- > bindings/rust/libgpiod/examples/gpioset.rs | 4 +- > bindings/rust/libgpiod/src/line_config.rs | 4 +- > bindings/rust/libgpiod/src/line_request.rs | 16 ++-- > bindings/rust/libgpiod/src/request_config.rs | 8 +- > bindings/rust/libgpiod/tests/common/config.rs | 8 +- > bindings/rust/libgpiod/tests/info_event.rs | 6 +- > bindings/rust/libgpiod/tests/line_config.rs | 2 +- > bindings/rust/libgpiod/tests/line_request.rs | 73 ++++++++----------- > .../rust/libgpiod/tests/request_config.rs | 2 +- > 13 files changed, 65 insertions(+), 72 deletions(-) Acked-by: Viresh Kumar <viresh.kumar@xxxxxxxxxx> -- viresh