Skip to content

Commit ee6a1e1

Browse files
author
Oliver Mangold
committed
New trait OwnableRefCounted for ARef<->Owned conversion.
This allows to convert between ARef<T> and Owned<T> by implementing the new trait OwnedRefCounted. This way we will have a shared/unique reference counting scheme for types with built-in refcounts in analogy to Arc/UniqueArc. To: Miguel Ojeda <[email protected]> To: Alex Gaynor <[email protected]> To: Boqun Feng <[email protected]> To: Gary Guo <[email protected]> To: Björn Roy Baron <[email protected]> To: Benno Lossin <[email protected]> To: Andreas Hindborg <[email protected]> To: Alice Ryhl <[email protected]> To: Trevor Gross <[email protected]> To: Asahi Lina <[email protected]> Cc: [email protected] Cc: [email protected] Signed-off-by: Oliver Mangold <[email protected]> --- Changes in v8: - EDITME: describe what is new in this series revision. - EDITME: use bulletpoints and terse descriptions. - Link to v7: https://lore.kernel.org/r/[email protected] Changes in v7: - Squash patch to make Owned::from_raw/into_raw public into parent - Added Signed-off-by to other people's commits - Link to v6: https://lore.kernel.org/r/[email protected] Changes in v6: - Changed comments/formatting as suggested by Miguel Ojeda - Included and used new config flag RUSTC_HAS_DO_NOT_RECOMMEND, thus no changes to types.rs will be needed when the attribute becomes available. - Fixed commit message for Owned patch. - Link to v5: https://lore.kernel.org/r/[email protected] Changes in v5: - Rebase the whole thing on top of the Ownable/Owned traits by Asahi Lina. - Rename AlwaysRefCounted to RefCounted and make AlwaysRefCounted a marker trait instead to allow to obtain an ARef<T> from an &T, which (as Alice pointed out) is unsound when combined with UniqueRef/Owned. - Change the Trait design and naming to implement this feature, UniqueRef/UniqueRefCounted is dropped in favor of Ownable/Owned and OwnableRefCounted is used to provide the functions to convert between Owned and ARef. - Link to v4: https://lore.kernel.org/r/[email protected] Changes in v4: - Just a minor change in naming by request from Andreas Hindborg, try_shared_to_unique() -> try_from_shared(), unique_to_shared() -> into_shared(), which is more in line with standard Rust naming conventions. - Link to v3: https://lore.kernel.org/r/Z8Wuud2UQX6Yukyr@mango --- b4-submit-tracking --- # This section is used internally by b4 prep for tracking purposes. { "series": { "revision": 8, "change-id": "20250305-unique-ref-29fcd675f9e9", "prefixes": [], "history": { "v4": [ "Z8Wuud2UQX6Yukyr@mango", "[email protected]" ], "v5": [ "[email protected]" ], "v6": [ "[email protected]" ], "v7": [ "[email protected]" ] } } }
1 parent 4b2ee22 commit ee6a1e1

File tree

0 file changed

+0
-0
lines changed

    0 file changed

    +0
    -0
    lines changed

    0 commit comments

    Comments
     (0)