Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
improve Pin documentation #58574
improve Pin documentation #58574
Changes from 1 commit
4059889
a8d18b9
a8111b7
442c486
0ba99f6
3040380
c774bc6
c8f4efc
11e48eb
2c6981a
d5df8a4
9c241aa
c52560d
06b2aff
1b556f1
c9ade6a
59bdb31
e61a8a9
2db0e0d
bcc55e5
6b88007
32a9614
811af42
497439c
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Add example snippet of happily moving
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 think that would just make things take more space without helping.
mem::replace
doesn't even mention any trait bound, so it would be really weird if it had any interaction withUnpin
. I will add an explanation of this.Every interruption of the text, like such an example, makes the flow of the text harder to follow-- so it must be worth it in terms of extra information content. (That'd be different if we moved all the examples to a separate section, but I don't consider that useful either.)
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 expanded the existing example a little, that should also help with this I think.
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.
A basic example snippet of where it can go wrong would be neat
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'm afraid there is no "basic" example of this that I know of.
When/if we have actual code for the intrusive doubly-linked list, that makes for an easy example.
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.
Exemplify the double-linked list with a snippet
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 may have time to do that on the week-end, but not before. That'll be a sizeable example (larger than anything I have seen so far in libstd), and writing that costs more time than I currently have.
But you could help by writing that code. :)
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 started an intrusive singly-linked list a while back, the code is non-trivial even when using some complicated helpers (
pin-project
for pin-projecting,ergo-pin
for stack pinning andgen_iter!
for creating inline generator backed iterators) and probably far too large to be included as an example in the standard library.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 am not sure if it has to be that complicated though, it doesn't have to actually provide a useful API, after all. My example in this blog post isn't too big, I feel.
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 function lacks a usage example
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 function lacks a correct usage example
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 function lacks a usage example
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 function lacks a usage example
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 function lacks a usage example
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 function lacks a usage example
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 function lacks a usage example