-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from yoshuawuyts/remove-maybe-done-vec-join
Remove `MaybeDone` from `impl Join for Vec`
- Loading branch information
Showing
5 changed files
with
160 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/// Enumerate the current poll state. | ||
#[derive(Debug, Clone, Copy, Default)] | ||
pub(crate) enum PollState { | ||
/// Polling the underlying future. | ||
#[default] | ||
Pending, | ||
/// Data has been written to the output structure | ||
/// and the future should no longer be polled. | ||
Done, | ||
/// Data has been consumed from the output structure, | ||
/// and we should no longer reason about it. | ||
Consumed, | ||
} | ||
|
||
impl PollState { | ||
/// Returns `true` if the metadata is [`Pending`]. | ||
/// | ||
/// [`Pending`]: Metadata::Pending | ||
#[must_use] | ||
pub(crate) fn is_pending(&self) -> bool { | ||
matches!(self, Self::Pending) | ||
} | ||
|
||
/// Returns `true` if the poll state is [`Done`]. | ||
/// | ||
/// [`Done`]: PollState::Done | ||
#[must_use] | ||
pub(crate) fn is_done(&self) -> bool { | ||
matches!(self, Self::Done) | ||
} | ||
|
||
/// Returns `true` if the poll state is [`Consumed`]. | ||
/// | ||
/// [`Consumed`]: PollState::Consumed | ||
#[must_use] | ||
pub(crate) fn is_consumed(&self) -> bool { | ||
matches!(self, Self::Consumed) | ||
} | ||
} |