-
Notifications
You must be signed in to change notification settings - Fork 161
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 AnyProvider #1495
Add AnyProvider #1495
Conversation
Notice: the branch changed across the force-push!
~ Your Friendly Jira-GitHub PR Checker Bot |
^ this is a rebase in order to pull in the new ZCF |
The commit history is a big mess, but the final result should be fairly clean. I removed erased.rs and replaced it with any.rs. The two files ended up being more similar than I had anticipated, but AnyProvider is more up-to-date with our latest design. I also rewrote StructProvider to operate on AnyPayloads. This makes it much more flexible, as can be seen in the DateTimeFormat test refactoring included in this PR. It may be desirable to rename the |
The types I ended up with are as follows:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great and is a much smaller change than I anticipated! A bunch of thoughts and questions, but nothing blocking, r=me
for<'a> YokeTraitHack<<M::Yokeable as Yokeable<'a>>::Output>: Clone, | ||
M::Yokeable: ZeroCopyFrom<'static, M::Yokeable>, | ||
{ | ||
self.try_unwrap_owned()?.downcast() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question: are we ever in danger from users manually constructing non-owned anypayloads?
(i know the current code has this too)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a test to demonstrate how one could trigger this code path to run.
pub key: ResourceKey, | ||
pub data: DataPayload<M>, | ||
pub data: AnyPayload, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thought(nb): These fields being public are fine but it might be nice API-wise to have a convenient constructor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a pre-existing issue, and I may make further revisions to this class after I do the other issues I have lined up, so I would rather not add a constructor right now.
Fixes #1479
This is a work-in-progress. Still to-do: