Skip to content

[RUST] Add borrowed object node cast - #734

Merged
tqchen merged 1 commit into
mainfrom
rust-borrowed-object-cast
Sep 3, 2026
Merged

[RUST] Add borrowed object node cast#734
tqchen merged 1 commit into
mainfrom
rust-borrowed-object-cast

Conversation

@tlopex

@tlopex tlopex commented Sep 3, 2026

Copy link
Copy Markdown
Member

This PR adds ObjectRefCore::as_node() for zero-copy borrowed object-node casts.

Checks such as is_zero currently clone an owning object handle before calling try_cast. This performs an atomic reference-count increment and decrement even though the caller only needs to inspect the node temporarily.

The new API checks the runtime type directly from the existing object header and returns a reference tied to the source handle. It does not clone the handle, construct an owning cast result, or update the reference count. Final node types, such as IntImmObj, use a fast exact type-index comparison.

@tqchen
tqchen merged commit c7a8cea into main Sep 3, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants