sel4_root_task/
termination.rsuse core::fmt;
pub trait Termination {
type Error: fmt::Debug;
fn report(self) -> Self::Error;
}
impl Termination for ! {
type Error = !;
fn report(self) -> Self::Error {
self
}
}
impl Termination for Never {
type Error = Never;
fn report(self) -> Self::Error {
self
}
}
impl<E: fmt::Debug> Termination for Result<!, E> {
type Error = E;
fn report(self) -> Self::Error {
match self {
#[allow(unreachable_patterns)]
Ok(absurdity) => match absurdity {},
Err(err) => err,
}
}
}
impl<E: fmt::Debug> Termination for Result<Never, E> {
type Error = E;
fn report(self) -> Self::Error {
match self {
#[allow(unreachable_patterns)]
Ok(absurdity) => match absurdity {},
Err(err) => err,
}
}
}
#[derive(Debug, Copy, Clone, PartialOrd, Ord, PartialEq, Eq, Hash)]
pub enum Never {}
impl fmt::Display for Never {
fn fmt(&self, _f: &mut fmt::Formatter) -> fmt::Result {
match *self {}
}
}