From: "Benno Lossin" <lossin@kernel.org>
To: "Miguel Ojeda" <miguel.ojeda.sandonis@gmail.com>,
"Shankari Anand" <shankari.ak0208@gmail.com>
Cc: linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org,
"Miguel Ojeda" <ojeda@kernel.org>,
"Alex Gaynor" <alex.gaynor@gmail.com>,
"Boqun Feng" <boqun.feng@gmail.com>,
"Gary Guo" <gary@garyguo.net>,
"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
"Andreas Hindborg" <a.hindborg@kernel.org>,
"Alice Ryhl" <aliceryhl@google.com>,
"Trevor Gross" <tmgross@umich.edu>,
"Danilo Krummrich" <dakr@kernel.org>
Subject: Re: [PATCH v4] rust: move ARef and AlwaysRefCounted to sync::aref
Date: Tue, 22 Jul 2025 11:32:56 +0200 [thread overview]
Message-ID: <DBIHASMYLFEZ.19R61CE8V745Q@kernel.org> (raw)
In-Reply-To: <CANiq72nZMLghTj8bHerEfXyYMtbWDH_WVxYeQY65ymWjSuxA_g@mail.gmail.com>
On Tue Jul 22, 2025 at 12:46 AM CEST, Miguel Ojeda wrote:
> On Tue, Jul 15, 2025 at 1:04 PM Shankari Anand
> <shankari.ak0208@gmail.com> wrote:
>>
>> +//! Built-in Reference Counting Support
>
> What is it meant by "built-in" here? Could we just use "Reference
> counting support."? Or do you have another suggestion, Benno?
`ARef` specifically is about supporting types that already have their
own "built-in" reference counting. I'm not sure if built-in is the best
word to describe that, some alternatives are inherent or internal.
Maybe we can just expand the module level docs with:
//! Internal Reference Counting Support.
//!
//! Many C types already have their own reference counting mechanism (e.g. by storing a
//! `refcount_t`). This module provides support for directly using their internal reference count
//! from Rust; instead of making users have to use an additional Rust-reference count in the form of
//! [`Arc`].
//!
//! The smart pointer [`ARef<T>`] acts similarly to [`Arc<T>`] in that it holds a refcount on the
//! underlying object, but this refcount is internal to the object. It essentially is a Rust
//! implementation of the `get_` and `put_` pattern used in C for reference counting.
//!
//! To make use of [`ARef<MyType>`], `MyType` needs to implement [`AlwaysRefCounted`]. It is a trait
//! for accessing the internal reference count of an object of the `MyType` type.
Thoughts?
---
Cheers,
Benno
next prev parent reply other threads:[~2025-07-22 9:33 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-15 11:04 [PATCH v4] rust: move ARef and AlwaysRefCounted to sync::aref Shankari Anand
2025-07-15 11:33 ` Benno Lossin
2025-07-21 22:46 ` Miguel Ojeda
2025-07-22 9:32 ` Benno Lossin [this message]
2025-07-22 10:28 ` Miguel Ojeda
2025-07-22 11:54 ` Miguel Ojeda
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=DBIHASMYLFEZ.19R61CE8V745Q@kernel.org \
--to=lossin@kernel.org \
--cc=a.hindborg@kernel.org \
--cc=alex.gaynor@gmail.com \
--cc=aliceryhl@google.com \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun.feng@gmail.com \
--cc=dakr@kernel.org \
--cc=gary@garyguo.net \
--cc=linux-kernel@vger.kernel.org \
--cc=miguel.ojeda.sandonis@gmail.com \
--cc=ojeda@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=shankari.ak0208@gmail.com \
--cc=tmgross@umich.edu \
/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).