-
Notifications
You must be signed in to change notification settings - Fork 639
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace DrainError and VecSinkError with Never
- Loading branch information
Showing
6 changed files
with
53 additions
and
41 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
//! Definition and trait implementations for the `Never` type, | ||
//! a stand-in for the `!` type until it becomes stable. | ||
use core::fmt; | ||
|
||
/// A type with no possible values. | ||
/// | ||
/// This is used to indicate values which can never be created, such as the | ||
/// error type of infallible futures. | ||
/// | ||
/// This type is a stable equivalent to the `!` type from `std`. | ||
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd)] | ||
pub enum Never {} | ||
|
||
impl Never { | ||
/// Convert the `Never` type into any other type. | ||
pub fn into_any<T>(self) -> T { | ||
match self {} | ||
} | ||
} | ||
|
||
impl fmt::Display for Never { | ||
fn fmt(&self, _: &mut fmt::Formatter<'_>) -> fmt::Result { | ||
match *self {} | ||
} | ||
} | ||
|
||
#[cfg(feature = "std")] | ||
impl std::error::Error for Never {} |
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