-
Notifications
You must be signed in to change notification settings - Fork 97
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 GuestMemory method to return an Iterator #130
Conversation
Should I make a separate PR for all the clippy fixes and miscellanea? |
It's okay to keep them in this pull request, but please move those that apply to the master branch in a separate commit; the others should be squashed in the commit that introduces the problem in the first place. Also, to complete my review:
|
Sounds good to me. I'll make this change.
There is no runtime usage for
It does need to be public as users may need to store and wrap iterators.
Since most (almost all) of these issues existed before, I've separated out the fixes for pre-existing clippy issues into #131. That should probably go through first and clear up the CI, then I'll rebase this and cleanup the commit history (along with the other requested changes) |
LGTM:) |
I'm confused. |
You are right:) |
Regarding documentation, I would like something like /// Lifetime generic associated iterator. Usually this is just `Self`. The actual
/// iterator type is specified through the `GuestMemoryIterator` trait, for example:
///
/// ```ignore
/// impl<'a> GuestMemoryIterator<'a, MyGuestRegion> for MyGuestMemory {
/// type Iter = MyGuestMemoryIter<'a>;
/// }
///
/// pub struct MyGuestMemoryIter<`a>( ... );
/// impl<'a> Iterator for MyGuestMemoryIter<'a> { ... }
/// ```
type Iterator: for<'a> GuestMemoryIterator<'a, Self::R>; that explains how to use the idiom. Finally, since it is public please rename the |
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 neat! I think we can avoid explicitly renaming the mmap::Iter
type to GuestMemoryMmapIter
, since the module path already provides sufficient context (this also happens for some of the iterators in the standard library, i.e. slice::Iter
).
It's definitely a good idea to keep the old methods around some more to avoid immediately breaking compatibility, but I think we should remove them at some point in the future. What do you folks think about marking them as deprecated for now, and removing them in a later release?
Finally, we should also add some changelog entries about the publicly visible changes (in an [Unreleased]
section right before [0.4.0]
, that's going to be renamed using the proper version number when we prepare the next release).
I'm also considering adding a
Am I correct that a |
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.
Just one remaining comment for the documentation.
Signed-off-by: Daniel Bloom <daniel.aaron.bloom@gmail.com>
Apologies for missing this comment earlier. In my mind, the question has increased in scope recently, for example also touching on the subject of how we can leverage something along these lines to simplify how cross-region accesses are performed. I'll open an issue as soon as some sort of idea does eventually crystallize, and hopefully we can reduce overall complexity some more. I'm also more than happy to discuss other ideas as well. |
Fixes #8.
This changes is similar to #9, which was rejected as it introduced a lifetime parameter to the trait, in favor of waiting for GAT/GAL. Since GAT/GAL still looks a ways off, this change does the same thing but using HRTBs.