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

Make AsStoreRef and friends work for anything that implements Deref #3586

Merged
merged 1 commit into from
Feb 15, 2023

Conversation

Michael-F-Bryan
Copy link
Contributor

Description

While updating some WAI code, I ran into a weird bug where &mut Store didn't implement AsEngineRef because we've only got an impl AsEngineRef for &Store.

This PR uses the Deref (or DerefMut, when applicable) trait to implement things like AsStoreRef, AsStoreMut, and AsEngineRef for anything that can be dereferenced to an implementation of those traits. That means we'll have the same &Store: AsEngineRef impl, but we'll also pick up AsEngineRef implementations for Box<T>, Arc<T>, and so on.

Copy link
Member

@syrusakbary syrusakbary left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love it

@Michael-F-Bryan Michael-F-Bryan merged commit 73d6c48 into master Feb 15, 2023
@Michael-F-Bryan Michael-F-Bryan deleted the as-engine-ref branch February 15, 2023 17:19
@theduke
Copy link
Contributor

theduke commented Feb 15, 2023

@Michael-F-Bryan nice !

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