All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Erik Schilling" <erik.schilling@linaro.org>
To: "Viresh Kumar" <viresh.kumar@linaro.org>
Cc: "Linux-GPIO" <linux-gpio@vger.kernel.org>,
	"Manos Pitsidianakis" <manos.pitsidianakis@linaro.org>
Subject: Re: [libgpiod][PATCH 2/3] bindings: rust: allow cloning line::Info -> line::OwnedInfo
Date: Fri, 29 Sep 2023 13:05:02 +0200	[thread overview]
Message-ID: <CVVCOO4NN17R.3TUR5CODRZEK@ablu-work> (raw)
In-Reply-To: <20230929105005.hssr5bgs7w5j24j6@vireshk-i7>

On Fri Sep 29, 2023 at 12:50 PM CEST, Viresh Kumar wrote:
> $subject: s/OwnedInfo/InfoOwned/

Whoops. Flipped that around at some point. Forgot to fix here... Will do
once we agreed on a naming scheme :)

>
> On 28-09-23, 14:52, Erik Schilling wrote:
> > On Wed Sep 27, 2023 at 6:29 PM CEST, Erik Schilling wrote:
> > > diff --git a/bindings/rust/libgpiod/src/line_info.rs b/bindings/rust/libgpiod/src/line_info.rs
> > > index 32c4bb2..fe01a14 100644
> > > --- a/bindings/rust/libgpiod/src/line_info.rs
> > > +++ b/bindings/rust/libgpiod/src/line_info.rs
> > > @@ -58,6 +58,22 @@ impl Info {
> > >          self as *const _ as *mut _
> > >      }
> > >  
> > > +    /// Clones the [gpiod::gpiod_line_info] instance to an [InfoOwned]
> > > +    pub fn try_clone(&self) -> Result<InfoOwned> {
> > 
> > Hm... I realized that we have `event_clone()` for cloning an `Event`
> > and `settings_clone()` for cloning `line::Settings`. Should better
> > stay consistent here...
> > 
> > However, I think the name `try_clone()` sounds more suitable to me. Any
> > opinions? I could send a patch to rename the existing cloning methods
> > to `try_clone()`.
>
> IIRC, I did try to use clone() and try_clone() earlier for something and there
> were prototype issues, as they weren't matching with the standard library and so
> had to innovate `event_clone()` and `settings_clone()`. `try_clone()` is anyday
> better.

ACK. I am not aware of any trait like `TryClone`, but yeah: `Clone` and
`ToOwned` do not work for the reason outlined in the commit message.

I will then add a commit to rename the other `*_clone` functions to
`try_clone` in v2.

- Erik


  reply	other threads:[~2023-09-29 11:05 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-27 16:29 [libgpiod][PATCH 0/3] bindings: rust: fix modeling of line_info lifetimes Erik Schilling
2023-09-27 16:29 ` [libgpiod][PATCH 1/3] bindings: rust: fix soundness of line_info modeling Erik Schilling
2023-09-28 11:27   ` Viresh Kumar
2023-09-28 12:27     ` Erik Schilling
2023-09-29 10:39       ` Viresh Kumar
2023-09-29 10:58         ` Erik Schilling
2023-09-29 11:02           ` Viresh Kumar
2023-09-28 13:24   ` Erik Schilling
2023-09-29 10:39     ` Viresh Kumar
2023-09-29 11:06       ` Erik Schilling
2023-09-29 10:50     ` Manos Pitsidianakis
2023-09-27 16:29 ` [libgpiod][PATCH 2/3] bindings: rust: allow cloning line::Info -> line::OwnedInfo Erik Schilling
2023-09-28 12:52   ` Erik Schilling
2023-09-29 10:50     ` Viresh Kumar
2023-09-29 11:05       ` Erik Schilling [this message]
2023-09-27 16:29 ` [libgpiod][PATCH 3/3] bindings: rust: bump major for libgpiod crate Erik Schilling
2023-09-29 12:43   ` Bartosz Golaszewski
2023-09-29 12:45     ` Erik Schilling

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CVVCOO4NN17R.3TUR5CODRZEK@ablu-work \
    --to=erik.schilling@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=manos.pitsidianakis@linaro.org \
    --cc=viresh.kumar@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.