-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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 RingBuf examples #15762
Add RingBuf examples #15762
Conversation
The imports for these examples seem fairly important, especially the import of use std::collections::{RingBuf, Deque}; |
@alexcrichton Yeah, I figure if it's assumed that you already need that import to work with the type in question, the example doesn't need to show it. |
I'm still in favour of adding the imports both here and for (Yes, people could find this out by reading rest of the |
Seems to me |
Removed r+ for now. Let's please not add anything to the prelude in this PR, let's just perhaps add the imports back in, but the shorter form like I mentioned, this will help with copy/pasting examples. |
Done. |
I fixed an issue with one of the examples that was preventing tests from passing. Also I've changed every |
/// buf.push(3i); | ||
/// buf.push(4); | ||
/// buf.push(5); | ||
/// assert!(buf.get(1) == &4); |
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.
Deque
is no longer used in these examples, so it should be removed. These assert!()
s should also be changed to assert_eq!()
.
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.
Ahh, I didn't realize that the push() methods are from a different trait. I've fixed this now.
Could you squash the commits together as well? |
Done |
This adds examples for get(), get_mut(), swap(), iter() and mut_iter()
fix: Fix metrics workflow to use deploy key I think this should be correct
This adds examples for get(), get_mut(), swap(), iter() and mut_iter()