[−][src]Enum market::Never
A type that can never be constructed.
Never
can never be constructed (in type theory parlance, it is
"uninhabited"). It represents any computation which never resolves to a
particular value (because it runs forever, panics, aborts the process, etc).
Because the Never
type can never be constructed, the existence of a
Never
proves that a piece of code can never be reached.
For example, we could write a function like:
fn result_into_ok<T>(res: Result<T, Never>) -> T { match res { Ok(t) => t, // This branch can never be taken, and so the // compiler is happy to treat it as evaluating // to whatever type we wish - in this case, `T`. Err(never) => match never {}, } }
Generalizing, it is always valid to convert a Never
into a value of any
other type. We provide the into_any
and to_any
methods for this
purpose.
Never
is a stable version of the currently-unstable !
type from the
standard library.
Implementations
impl Never
[src]
pub fn into_any<T>(self) -> T
[src]
Convert this Never
into a value of a different type.
Since a Never
can never be constructed, this is valid for any Sized
type.
pub fn to_any<T>(&self) -> T
[src]
Convert this Never
into a value of a different type.
Since a Never
can never be constructed, this is valid for any Sized
type.
Trait Implementations
impl<T> AsMut<T> for Never where
T: ?Sized,
[src]
T: ?Sized,
impl<T> AsRef<T> for Never where
T: ?Sized,
[src]
T: ?Sized,
impl BufRead for Never
[src]
fn fill_buf(&mut self) -> Result<&[u8], Error>
[src]
fn consume(&mut self, _amt: usize)
[src]
fn read_until(&mut self, byte: u8, buf: &mut Vec<u8>) -> Result<usize, Error>
1.0.0[src]
fn read_line(&mut self, buf: &mut String) -> Result<usize, Error>
1.0.0[src]
fn split(self, byte: u8) -> Split<Self>
1.0.0[src]
fn lines(self) -> Lines<Self>
1.0.0[src]
impl Clone for Never
[src]
impl Copy for Never
[src]
impl Debug for Never
[src]
impl Display for Never
[src]
impl Eq for Never
[src]
impl Error for Never
[src]
fn source(&self) -> Option<&(dyn Error + 'static)>
1.30.0[src]
fn backtrace(&self) -> Option<&Backtrace>
[src]
fn description(&self) -> &str
1.0.0[src]
fn cause(&self) -> Option<&dyn Error>
1.0.0[src]
impl Hash for Never
[src]
fn hash<__H>(&self, state: &mut __H) where
__H: Hasher,
[src]
__H: Hasher,
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl Ord for Never
[src]
fn cmp(&self, other: &Never) -> Ordering
[src]
#[must_use]fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn clamp(self, min: Self, max: Self) -> Self
[src]
impl PartialEq<Never> for Never
[src]
impl PartialOrd<Never> for Never
[src]
fn partial_cmp(&self, other: &Never) -> Option<Ordering>
[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl Read for Never
[src]
fn read(&mut self, _buf: &mut [u8]) -> Result<usize, Error>
[src]
fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize, Error>
1.36.0[src]
fn is_read_vectored(&self) -> bool
[src]
unsafe fn initializer(&self) -> Initializer
[src]
fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize, Error>
1.0.0[src]
fn read_to_string(&mut self, buf: &mut String) -> Result<usize, Error>
1.0.0[src]
fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Error>
1.6.0[src]
fn by_ref(&mut self) -> &mut Self
1.0.0[src]
fn bytes(self) -> Bytes<Self>
1.0.0[src]
fn chain<R>(self, next: R) -> Chain<Self, R> where
R: Read,
1.0.0[src]
R: Read,
fn take(self, limit: u64) -> Take<Self>
1.0.0[src]
impl Seek for Never
[src]
fn seek(&mut self, _pos: SeekFrom) -> Result<u64, Error>
[src]
fn stream_len(&mut self) -> Result<u64, Error>
[src]
fn stream_position(&mut self) -> Result<u64, Error>
[src]
impl StructuralEq for Never
[src]
impl StructuralPartialEq for Never
[src]
impl Write for Never
[src]
fn write(&mut self, _buf: &[u8]) -> Result<usize, Error>
[src]
fn flush(&mut self) -> Result<(), Error>
[src]
fn write_vectored(&mut self, bufs: &[IoSlice<'_>]) -> Result<usize, Error>
1.36.0[src]
fn is_write_vectored(&self) -> bool
[src]
fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
1.0.0[src]
fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
[src]
fn write_fmt(&mut self, fmt: Arguments<'_>) -> Result<(), Error>
1.0.0[src]
fn by_ref(&mut self) -> &mut Self
1.0.0[src]
Auto Trait Implementations
impl RefUnwindSafe for Never
impl Send for Never
impl Sync for Never
impl Unpin for Never
impl UnwindSafe for Never
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<N, S> AssembleInto<S> for N where
S: AssembleFrom<N>,
[src]
S: AssembleFrom<N>,
type Error = <S as AssembleFrom<N>>::Error
The type of the error that could be thrown during assembly.
fn assemble_into(
components: &mut Vec<N>
) -> Result<S, AssembleFailure<<N as AssembleInto<S>>::Error>>
[src]
components: &mut Vec<N>
) -> Result<S, AssembleFailure<<N as AssembleInto<S>>::Error>>
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<N, S> DisassembleInto<N> for S where
N: DisassembleFrom<S>,
[src]
N: DisassembleFrom<S>,
type Error = <N as DisassembleFrom<S>>::Error
The type of the error that could be thrown during disassembly.
fn disassemble_into(self) -> Result<Vec<N>, <S as DisassembleInto<N>>::Error>
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,