-
-
Notifications
You must be signed in to change notification settings - Fork 175
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 BookmarkList
example
#1347
Add BookmarkList
example
#1347
Conversation
I was expecting a proper example in https://github.com/gtk-rs/gtk4-rs/tree/master/examples instead |
Oh yeah, that is a good idea too! I was thinking of having a example section in the docblock to sit shows in the documentation and when using the "Go to definition" in the IDE. Does this project accept examples in the docblock too? |
gtk4/src/bookmark_list.rs
Outdated
/// To iterate over `BookmarkList` call `iter::<gio::FileInfo>` to get an iterator. | ||
/// ```no_run | ||
/// let bookmarks = gtk::BookmarkList::new(Some("bookmarks.xbel"), None); | ||
/// for bookmark in bookmarks.iter::<gio::FileInfo>() { |
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 example looks weird to rust ppl I think.
Would it better to use
while let Some(Ok(bookmark)) = bookmarks.iter::<gio::FileInfo>().next() {
// ...
}
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.
@bilelmoussaoui What do you 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.
I agree with what @zekefast said. Although, does this example shows in the docs?
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.
Okay I updated the PR with the example provided by @zekefast. I am not sure, but it should show up when you press F12 in VS 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.
You would have to resolve merge conflicts, the PR as is can't be tested by the CI nor merged
Please test locally first.... |
Add example for #1346.