Enum lattice_qcd_rs::error::Never
source · pub enum Never {}
Expand description
A type that can never be (safely) initialized.
This is temporary, until never
is accepted into stable rust.
Example
trait Something {
type Error;
fn do_something(&self) -> Result<(), Self::Error>;
}
struct SomethingImpl;
impl Something for SomethingImpl {
type Error = Never; // We never have an error
fn do_something(&self) -> Result<(), Self::Error> {
// implementation that never fails
Ok(())
}
}
the size of Never
is 0
assert_eq!(std::mem::size_of::<Never>(), 0);
// the size is still zero. because () is size 0.
assert_eq!(std::mem::size_of::<Result<(), Never>>(), 0);
assert_eq!(std::mem::size_of::<Result<u8, Never>>(), 1);
Trait Implementations§
source§impl<'de> Deserialize<'de> for Never
impl<'de> Deserialize<'de> for Never
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl Error for Never
impl Error for Never
1.30.0 · source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
The lower-level source of this error, if any. Read more
1.0.0 · source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
source§impl Ord for Never
impl Ord for Never
source§impl PartialEq<Never> for Never
impl PartialEq<Never> for Never
source§impl PartialOrd<Never> for Never
impl PartialOrd<Never> for Never
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl Copy for Never
impl Eq for Never
impl StructuralEq for Never
impl StructuralPartialEq for Never
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> Pointable for T
impl<T> Pointable for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self
from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self
is actually part of its subset T
(and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self
to the equivalent element of its superset.