Implement `AsRef` for casting to superclasses
Open
cpp-feature
- Dominant language
- Rust
- Stars
- 2.6k
- Forks
- 175
- PR merge metrics
- No merged PRs in 30d
Description
If you have a reference `b_ref: &B`, and `B` is a subclass of `A`, it would sometimes be useful to have an `&A` in order to pass into APIs which expect a `&A`. Experiments suggest that this is ergonomic using `AsRef`, at least for constant references (not so much for pinned mutable references).
Contributor guide
Research direction
Start by reviewing the issue's experiments with Rust AsRef and the repository's Rust/C++ interop implementation. Determine how constant references from a subclass should convert to superclass references, including the stated limitations around pinned mutable references; done means the supported conversion is implemented and covered by tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, rust
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100