-
Notifications
You must be signed in to change notification settings - Fork 56
Add accessors to Consume #148
Add accessors to Consume #148
Conversation
This allows properly implementing Consumer to create new queue implementations outside of the rubble crate. Signed-off-by: David Ross <[email protected]>
rubble/src/link/queue.rs
Outdated
&self.result | ||
} | ||
|
||
/// Unwraps this [`Consume`], retrieving the inner result. |
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.
The link doesn't go anywhere
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.
Right. I'm not entirely sure what I was thinking with this, thanks for catching it!
rubble/src/link/queue.rs
Outdated
@@ -190,6 +190,21 @@ impl<T> Consume<T> { | |||
result, | |||
} | |||
} | |||
|
|||
/// Retrieves whether this consume represents consuming a packet or not. |
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.
/// Retrieves whether this consume represents consuming a packet or not. | |
/// Retrieves whether the packet should be removed from the queue. |
rubble/src/link/queue.rs
Outdated
@@ -190,6 +190,21 @@ impl<T> Consume<T> { | |||
result, | |||
} | |||
} | |||
|
|||
/// Retrieves whether this consume represents consuming a packet or not. | |||
pub fn consume(&self) -> bool { |
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.
Maybe should_consume
would be better? Feel free to rename the field to match as well.
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.
Renamed!
Signed-off-by: David Ross <[email protected]>
Signed-off-by: David Ross <[email protected]>
Signed-off-by: David Ross <[email protected]>
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.
Great, thanks!
Fixes #145
I haven't thought a ton about the naming of these methods, but they should work alright.