question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Summary

  • Allow pattern matching through types that impl Deref or DerefMut.
  • Limited to types in stdlib where we can manually annotate them as pure for now.

Info

What is this issue?

This issue represents an active project group. It is meant to be used for the group to post updates to the lang team (and others) in a lightweight fashion. Please do not use the comments here for discussion, that should be kept in the Zulip stream (discussion comments here will be marked as off-topic).

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:3
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

14reactions
chorman0773commented, Oct 5, 2021

Progress Update:

  • Since the last update, implementation work has begun (though limited progress has been made on that). It will initially use the “no syntax” option, and the work with the types presented above. A tracking issue has also been opened, https://github.com/rust-lang/rust/issues/87121.
6reactions
safinaskarcommented, Aug 3, 2022

For those who cannot wait: my proc macro crate with deref patterns: https://crates.io/crates/match_deref

Read more comments on GitHub >

github_iconTop Results From Across the Web

Deref Polymorphism - Rust Design Patterns
The Deref trait is designed for the implementation of custom pointer types. The intention is that it will take a pointer-to- T to...
Read more >
Deref Patterns, requirements and Syntax Tracking Document
Deref Patterns, requirements and Syntax Tracking Document Discussion on irlo: ... Be able to match through a Deref or DerefMut smart pointer ergonomically....
Read more >
Somewhat Random Idea: Deref patterns - Rust Internals
Currently there is no way to match a type through a deref boundery, without introducing nested matches. The one exception is Box with ......
Read more >
lang-team/deref-patterns.md at master - GitHub
Allow pattern matching through types that impl Deref or DerefMut . Summary and problem statement. Currently in rust, matching is blocked by bounderies...
Read more >
How to pattern match on values inside a type implementing ...
And we can't just change the Deref trait because what would you return instead? By value doesn't work. If Rust could return lvalues...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found