Skip to content
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 MountInfos::iter #300

Merged
merged 1 commit into from
Feb 3, 2024
Merged

Add MountInfos::iter #300

merged 1 commit into from
Feb 3, 2024

Conversation

rusty-snake
Copy link
Contributor

This is a convenience for mountinfo.0.iter().

This is a convenience for mountinfo.0.iter().
@@ -49,6 +49,13 @@ bitflags! {
/// This data is taken from the `/proc/[pid]/mountinfo` file.
pub struct MountInfos(pub Vec<MountInfo>);

impl MountInfos {
/// Returns an borrowed iterator.
pub fn iter(&self) -> std::slice::Iter<'_, MountInfo> {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a minor point, but I wonder if we could do:

Suggested change
pub fn iter(&self) -> std::slice::Iter<'_, MountInfo> {
pub fn iter(&self) -> impl Iterator<Item = &MountInfo> {

to hide the std::slice::Iter concrete type. In practice this doesn't matter much because the inner Vec is part of the public API of MountInfos (and so std::slice::Iter is kind of part of this API too)

@eminence
Copy link
Owner

eminence commented Feb 3, 2024

LGTM, thanks!

@eminence eminence merged commit 7491fd3 into eminence:master Feb 3, 2024
6 checks passed
@rusty-snake rusty-snake deleted the mountinfos-iter branch February 3, 2024 18:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants