Re: [PATCH v8 1/4] rust: types: Add Ownable/Owned types

From: Andreas Hindborg
Date: Sun Mar 23 2025 - 16:47:24 EST


"Oliver Mangold" <oliver.mangold@xxxxx> writes:

> From: Asahi Lina <lina@xxxxxxxxxxxxx>
>
> By analogy to AlwaysRefCounted and ARef, an Ownable type is a (typically
> C FFI) type that *may* be owned by Rust, but need not be. Unlike
> AlwaysRefCounted, this mechanism expects the reference to be unique
> within Rust, and does not allow cloning.
>
> Conceptually, this is similar to a KBox<T>, except that it delegates
> resource management to the T instead of using a generic allocator.
>
> Link: https://lore.kernel.org/all/20250202-rust-page-v1-1-e3170d7fe55e@xxxxxxxxxxxxx/
> Signed-off-by: Asahi Lina <lina@xxxxxxxxxxxxx>
> [ om: make from_raw() and into_raw() public, small fixes to documentation ]
> Signed-off-by: Oliver Mangold <oliver.mangold@xxxxx>

Please see review comments for the original posting of the patch from
Alice [1] and me [2].


Best regards,
Andreas Hindborg


[1] https://lore.kernel.org/all/CAH5fLggscATtCgQwCYSms77oSFOMkjTscRDqAOZsSgoHsOoPQw@xxxxxxxxxxxxxx
[2] https://lore.kernel.org/all/87h64qe3dt.fsf@xxxxxxxxxx