Enum lattice_qcd_rs::utils::Sign
source · pub enum Sign {
Negative,
Positive,
Zero,
}
Expand description
Represent a sign.
Variants§
Negative
Strictly negative number (non zero)
Positive
Strictly positive number ( non zero)
Zero
Zero (or very close to zero)
Implementations§
source§impl Sign
impl Sign
sourcepub fn sign_f64(f: f64) -> Self
pub fn sign_f64(f: f64) -> Self
Get the sign form a f64.
If the value is very close to zero but not quite the sing will nonetheless be Sign::Zero
.
If f is NaN the sing will be Sign::Zero
.
sourcepub const fn sign_from_diff(a: usize, b: usize) -> Self
pub const fn sign_from_diff(a: usize, b: usize) -> Self
Returns the sign of a - b
, where a
and b
are usize
Trait Implementations§
source§impl<'de> Deserialize<'de> for Sign
impl<'de> Deserialize<'de> for Sign
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 MulAssign<Sign> for Sign
impl MulAssign<Sign> for Sign
source§fn mul_assign(&mut self, rhs: Self)
fn mul_assign(&mut self, rhs: Self)
Performs the
*=
operation. Read moresource§impl Ord for Sign
impl Ord for Sign
source§impl PartialEq<Sign> for Sign
impl PartialEq<Sign> for Sign
source§impl PartialOrd<Sign> for Sign
impl PartialOrd<Sign> for Sign
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 Sign
impl Eq for Sign
impl StructuralEq for Sign
impl StructuralPartialEq for Sign
Auto Trait Implementations§
impl RefUnwindSafe for Sign
impl Send for Sign
impl Sync for Sign
impl Unpin for Sign
impl UnwindSafe for Sign
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.