Skip to content
This repository has been archived by the owner on May 18, 2022. It is now read-only.

Add accessors to Consume #148

Merged
merged 4 commits into from
Aug 14, 2020

Conversation

daboross
Copy link
Contributor

Fixes #145

I haven't thought a ton about the naming of these methods, but they should work alright.

This allows properly implementing Consumer to create new queue
implementations outside of the rubble crate.

Signed-off-by: David Ross <[email protected]>
&self.result
}

/// Unwraps this [`Consume`], retrieving the inner result.
Copy link
Owner

Choose a reason for hiding this comment

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

The link doesn't go anywhere

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right. I'm not entirely sure what I was thinking with this, thanks for catching it!

@@ -190,6 +190,21 @@ impl<T> Consume<T> {
result,
}
}

/// Retrieves whether this consume represents consuming a packet or not.
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
/// Retrieves whether this consume represents consuming a packet or not.
/// Retrieves whether the packet should be removed from the queue.

@@ -190,6 +190,21 @@ impl<T> Consume<T> {
result,
}
}

/// Retrieves whether this consume represents consuming a packet or not.
pub fn consume(&self) -> bool {
Copy link
Owner

Choose a reason for hiding this comment

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

Maybe should_consume would be better? Feel free to rename the field to match as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Renamed!

David Ross added 3 commits August 14, 2020 05:43
Signed-off-by: David Ross <[email protected]>
Signed-off-by: David Ross <[email protected]>
Copy link
Owner

@jonas-schievink jonas-schievink left a comment

Choose a reason for hiding this comment

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

Great, thanks!

@jonas-schievink jonas-schievink merged commit 1c2014f into jonas-schievink:master Aug 14, 2020
@daboross daboross deleted the add-consume-access branch August 15, 2020 00:36
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

External code can't access Consume fields, and thus can't implement Consumer
2 participants