rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Ariel Miculas (amiculas)" <amiculas@cisco.com>
To: Alice Ryhl <aliceryhl@google.com>
Cc: "nmi@metaspace.dk" <nmi@metaspace.dk>,
	"alex.gaynor@gmail.com" <alex.gaynor@gmail.com>,
	"benno.lossin@proton.me" <benno.lossin@proton.me>,
	"bjorn3_gh@protonmail.com" <bjorn3_gh@protonmail.com>,
	"boqun.feng@gmail.com" <boqun.feng@gmail.com>,
	"gary@garyguo.net" <gary@garyguo.net>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"ojeda@kernel.org" <ojeda@kernel.org>,
	"patches@lists.linux.dev" <patches@lists.linux.dev>,
	"rust-for-linux@vger.kernel.org" <rust-for-linux@vger.kernel.org>,
	"wedsonaf@gmail.com" <wedsonaf@gmail.com>
Subject: Re: [PATCH v1] rust: add improved version of `ForeignOwnable::borrow_mut`
Date: Wed, 25 Oct 2023 12:22:35 +0000	[thread overview]
Message-ID: <rfx55e62g3uvdwunxtfkhheyhgnfgladthezuig2gk4uaaksat@pd4pttamfff2> (raw)
In-Reply-To: <20230823103458.243871-1-aliceryhl@google.com>

On 23/08/23 10:34AM, Alice Ryhl wrote:
> Andreas Hindborg <nmi@metaspace.dk> writes:
> >>> I am not sure this makes sense. How about splitting the trait in two,
> >>> immutable and mutable and only implementing the immutable one or Arc?
> >>
> >> I used this design based on what would make sense for a linked list. The
> >> idea is that we can have two different types of cursors for a linked
> >> list: immutable and mutable. The immutable cursor lets you:
> >>
> >>  * move around the linked list
> >>  * access the values using `borrow`
> >>
> >> The mutable cursor lets you:
> >>
> >>  * move around the linked list
> >>  * delete or add items to the list
> >>  * access the values using `borrow_mut`
> >>
> >> The mutable cursor gives you extra abilities beyond the `borrow` vs
> >> `borrow_mut` distinction, so we want to provide both types of cursors
> >> even if the pointer type is Arc. To do that, we need a trait that
> >> defines what it means to have mutable access to an Arc.
> > 
> > I don't see how that prevents this trait from being split in two?
> 
> Well, you could split the trait, but if you make the mutable iterator
> require the `borrow_mut` trait, then you have to implement the mutable
> trait for `Arc` too if you want the mutable iterator to work with `Arc`.
> 
> And if you're always going to implement both traits, then maybe it
> makes more sense to not split the traits?
> 
> Alice

I see this patch present in the rust-dev branch, but not in rust-next.
Are there plans for including this patch in rust-next?

Cheers,
Ariel

      parent reply	other threads:[~2023-10-25 12:22 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-10  7:46 [PATCH v1] rust: add improved version of `ForeignOwnable::borrow_mut` Alice Ryhl
2023-07-11 17:42 ` Boqun Feng
2023-07-14 10:28   ` Alice Ryhl
2023-07-13  3:28 ` Martin Rodriguez Reboredo
2023-07-15 13:38 ` Benno Lossin
2023-08-09 14:09 ` Andreas Hindborg (Samsung)
2023-08-22  9:31   ` Alice Ryhl
2023-08-23  8:40     ` Andreas Hindborg (Samsung)
2023-08-22  9:31   ` Alice Ryhl
2023-08-23  8:43     ` Andreas Hindborg (Samsung)
2023-08-23 10:34       ` Alice Ryhl
2023-08-23 16:09         ` Andreas Hindborg (Samsung)
2023-10-25 12:22         ` Ariel Miculas (amiculas) [this message]

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=rfx55e62g3uvdwunxtfkhheyhgnfgladthezuig2gk4uaaksat@pd4pttamfff2 \
    --to=amiculas@cisco.com \
    --cc=alex.gaynor@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=benno.lossin@proton.me \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=gary@garyguo.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nmi@metaspace.dk \
    --cc=ojeda@kernel.org \
    --cc=patches@lists.linux.dev \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=wedsonaf@gmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).