Re: [PATCH] rust: adding UniqueRefCounted and UniqueRef types
From: Boqun Feng
Date: Fri Feb 28 2025 - 11:21:49 EST
On Fri, Feb 28, 2025 at 04:06:01PM +0000, Oliver Mangold wrote:
> >
> > Hmm... Something went wrong here -- this patch looks broken, e.g. the
> > SoB is at the end, the title does not say v2, these replies seem to be
> > part of the patch, etc.
> >
> Hi,
>
> should I post it again with a fix, then?
>
> > (Also, by the way, in case it helps, the message got marked as spam in
> > my side for some reason).
> >
>
> Cannot comment on that. The mysteries of a spam filter :)
>
> On 250228 0754, Boqun Feng wrote:
> >
> > One meta comment: could you add examples for the usage of UniqueRef?
> > Ideally, we should have example code for all the new APIs, so that we at
> > least have some test payload on them (doctest will be generated as kunit
> > test).
>
> For now I can point you to the implementation for block::mq::Request which
> Andreas did on top of this. So there will shortly at least one actual user
> of the API (which uses all the features, as I believe).
>
I meant the "# Examples" section in the function documentation, you can
see UniqueArc for example:
https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/rust/kernel/sync/arc.rs#n592
(in case I wasn't clear)
> https://github.com/metaspace/linux/commit/797b90ae0f83b45495364d4c31651bca06471ef0
>
> But if you still need a separate test, I can do one during the next couple
Yes, we do because we are trying to maintain an API here, and we need at
least some unit tests to verify the correctness of an API. Thanks!
Regards,
Boqun
> of days.
>
> Best,
>
> Oliver
>