[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <DBIHASMYLFEZ.19R61CE8V745Q@kernel.org>
Date: Tue, 22 Jul 2025 11:32:56 +0200
From: "Benno Lossin" <lossin@...nel.org>
To: "Miguel Ojeda" <miguel.ojeda.sandonis@...il.com>, "Shankari Anand"
<shankari.ak0208@...il.com>
Cc: <linux-kernel@...r.kernel.org>, <rust-for-linux@...r.kernel.org>,
"Miguel Ojeda" <ojeda@...nel.org>, "Alex Gaynor" <alex.gaynor@...il.com>,
"Boqun Feng" <boqun.feng@...il.com>, "Gary Guo" <gary@...yguo.net>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>, "Andreas
Hindborg" <a.hindborg@...nel.org>, "Alice Ryhl" <aliceryhl@...gle.com>,
"Trevor Gross" <tmgross@...ch.edu>, "Danilo Krummrich" <dakr@...nel.org>
Subject: Re: [PATCH v4] rust: move ARef and AlwaysRefCounted to sync::aref
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@...il.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
Powered by blists - more mailing lists