Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ChildRef::is_child #816

Merged
merged 1 commit into from
Mar 14, 2022
Merged

Add ChildRef::is_child #816

merged 1 commit into from
Mar 14, 2022

Conversation

lxfind
Copy link
Contributor

@lxfind lxfind commented Mar 13, 2022

It's a common need to check whether a child_ref points to a specific child object.
Add is_child for this purpose. It also enforces the type parameter on ChildRef is the same as the type of the child object, which helps avoid mistakes of mixing up the types (as we have seen in #777).
However, there are also cases (still questionable) we need to check the id against a naked id instead of child object. In this case, we also introduce the unsafe version, but only expose it to a limited number of friend classes in the framework.
If in the future we see this a common need, we could open it up.

@lxfind lxfind merged commit 90201f4 into main Mar 14, 2022
@lxfind lxfind deleted the add-is-child branch March 14, 2022 01:16
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.

None yet

2 participants