Skip to main content

NonZero

Struct NonZero 

Source
pub struct NonZero<T: Zero>(pub T);
Expand description

A newtype which certifies the value is non-zero

Tuple Fieldsยง

ยง0: T

Implementationsยง

Sourceยง

impl<T: Zero> NonZero<T>

Source

pub fn new(value: T) -> Option<Self>

Certifies that value is nonzero.

Returns None when value is zero.

Source

pub fn new_unchecked(value: T) -> Self

Constructs a certified nonzero value without checking the invariant.

Callers must establish by construction that value is not zero. This is a logical unchecked constructor rather than an unsafe memory operation; violating the invariant can nevertheless invalidate the algebraic assumptions of DivRing and Field.

Trait Implementationsยง

Sourceยง

impl<T: Clone + Zero> Clone for NonZero<T>

Sourceยง

fn clone(&self) -> NonZero<T>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) ยท Sourceยง

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Sourceยง

impl<T: Copy + Zero> Copy for NonZero<T>

Sourceยง

impl<T: Debug + Zero> Debug for NonZero<T>

Sourceยง

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Sourceยง

impl<T: Eq + Zero> Eq for NonZero<T>

Sourceยง

impl<T: Zero + One + Point> Group for NonZero<T>
where NonZero<T>: Inv<Output = Self>,

Sourceยง

fn identity() -> Self

Sourceยง

fn compose(&self, other: &Self) -> Self

Sourceยง

fn inverse(&self) -> Self

Sourceยง

fn check_left_identity(&self) -> bool
where Self: PartialEq,

Sourceยง

fn check_right_identity(&self) -> bool
where Self: PartialEq,

Sourceยง

fn check_associativity(a: Self, b: Self, c: Self) -> bool
where Self: PartialEq,

Sourceยง

fn check_left_inverse(&self) -> bool
where Self: PartialEq + Debug,

Sourceยง

fn check_right_inverse(&self) -> bool
where Self: PartialEq,

Sourceยง

impl<R: Real> Interval for NonZero<Complex<R>>

Sourceยง

type R = R

The ordered field the interval is valued in โ€” the real field where magnitudes, distances, and convergence live. Distinct from a scalar fieldโ€™s involution Fixed: analysis happens here regardless of the algebraic involution.
Sourceยง

fn interval_squared(&self, other: &Self) -> R

The signed squared interval sยฒ(a, b) โ€” the primitive from which interval (its signed square root) and distance both derive. Read more
Sourceยง

fn interval(&self, other: &Self) -> Complex<Self::R>

Interval between self and other. Real or imaginary carries causal character.
Sourceยง

fn check_interval_symmetry(a: Self, b: Self) -> bool

Sourceยง

fn check_self_interval_zero(a: Self) -> bool

Sourceยง

fn check_interval_squared_agrees_with_interval(a: &Self, b: &Self) -> bool

Sourceยง

impl<R: Real> Inv for NonZero<Complex<R>>

Sourceยง

type Output = NonZero<Complex<R>>

The result after applying the operator.
Sourceยง

fn inv(self) -> Self::Output

Returns the multiplicative inverse of self. Read more
Sourceยง

impl Inv for NonZero<R64>

Sourceยง

type Output = NonZero<R64>

The result after applying the operator.
Sourceยง

fn inv(self) -> Self

Returns the multiplicative inverse of self. Read more
Sourceยง

impl Inv for NonZero<R32>

Sourceยง

type Output = NonZero<R32>

The result after applying the operator.
Sourceยง

fn inv(self) -> Self

Returns the multiplicative inverse of self. Read more
Sourceยง

impl<R: Real> Inv for NonZero<Quaternion<R>>

Sourceยง

type Output = NonZero<Quaternion<R>>

The result after applying the operator.
Sourceยง

fn inv(self) -> Self::Output

Returns the multiplicative inverse of self. Read more
Sourceยง

impl<T: Zero + One + Inv<Output = T>> Inv for NonZero<T>

Sourceยง

type Output = NonZero<T>

The result after applying the operator.
Sourceยง

fn inv(self) -> Self::Output

Returns the multiplicative inverse of self. Read more
Sourceยง

impl<F: CField> Inv for NonZero<Symmetrized<F>>

Sourceยง

type Output = NonZero<Symmetrized<F>>

The result after applying the operator.
Sourceยง

fn inv(self) -> Self::Output

Returns the multiplicative inverse of self. Read more
Sourceยง

impl<R: Real> LieGroup<Coords<R, 2>> for NonZero<Complex<R>>

Sourceยง

fn identity_exp(v: Coords<R, 2>) -> Self

Sourceยง

fn identity_log(p: &Self) -> Option<Coords<R, 2>>

Sourceยง

impl<T: Zero + One> Mul for NonZero<T>

Sourceยง

type Output = NonZero<T>

The resulting type after applying the * operator.
Sourceยง

fn mul(self, rhs: Self) -> Self::Output

Performs the * operation. Read more
Sourceยง

impl<T: Zero + One> One for NonZero<T>

Sourceยง

fn one() -> Self

Returns the multiplicative identity element of Self, 1. Read more
Sourceยง

fn set_one(&mut self)

Sets self to the multiplicative identity element of Self, 1.
Sourceยง

fn is_one(&self) -> bool
where Self: PartialEq,

Returns true if self is equal to the multiplicative identity. Read more
Sourceยง

impl<T: Ord + Zero> Ord for NonZero<T>

Sourceยง

fn cmp(&self, other: &NonZero<T>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 (const: unstable) ยท Sourceยง

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) ยท Sourceยง

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 (const: unstable) ยท Sourceยง

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Sourceยง

impl<T: PartialEq + Zero> PartialEq for NonZero<T>

Sourceยง

fn eq(&self, other: &NonZero<T>) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) ยท Sourceยง

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Sourceยง

impl<T: PartialOrd + Zero> PartialOrd for NonZero<T>

Sourceยง

fn partial_cmp(&self, other: &NonZero<T>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) ยท Sourceยง

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) ยท Sourceยง

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) ยท Sourceยง

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) ยท Sourceยง

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Sourceยง

impl<T: PartialEq + Zero> StructuralPartialEq for NonZero<T>

Auto Trait Implementationsยง

ยง

impl<T> Freeze for NonZero<T>
where T: Freeze,

ยง

impl<T> RefUnwindSafe for NonZero<T>
where T: RefUnwindSafe,

ยง

impl<T> Send for NonZero<T>
where T: Send,

ยง

impl<T> Sync for NonZero<T>
where T: Sync,

ยง

impl<T> Unpin for NonZero<T>
where T: Unpin,

ยง

impl<T> UnsafeUnpin for NonZero<T>
where T: UnsafeUnpin,

ยง

impl<T> UnwindSafe for NonZero<T>
where T: UnwindSafe,

Blanket Implementationsยง

Sourceยง

impl<T> Any for T
where T: 'static + ?Sized,

Sourceยง

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Sourceยง

impl<T> Borrow<T> for T
where T: ?Sized,

Sourceยง

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Sourceยง

impl<T> BorrowMut<T> for T
where T: ?Sized,

Sourceยง

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Sourceยง

impl<V, S> Chart<S, V> for S
where V: Tensor, S: Smooth<V>,

Sourceยง

type Global = <S as Smooth<V>>::Global

The result of mapping local coordinates back onto the manifold. Read more
Sourceยง

fn to_local(&self, point: &S) -> Option<V>

Sourceยง

fn to_global(&self, coord: V) -> <S as Smooth<V>>::Global

Sourceยง

fn chart_at(p: &S) -> S

Sourceยง

fn local_distance(&self, other: &P) -> Option<<V::F as Field>::Fixed>
where V: Euclidean,

Calculates the distance between self and other in local coordinates, based at &self.
Sourceยง

fn check_local_inverse(p: &P) -> bool
where P: PartialEq,

Sourceยง

impl<T> CloneToUninit for T
where T: Clone,

Sourceยง

unsafe fn clone_to_uninit(&self, dest: *mut u8)

๐Ÿ”ฌThis is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Sourceยง

impl<๐’ž, X> Equivalent<๐’ž, X> for X
where ๐’ž: Cat,

Sourceยง

fn project(self) -> X

Sourceยง

fn lift(x: X) -> X

Sourceยง

impl<V, L> ExpMap<L, V> for L
where V: Tensor, L: Smooth<V>,

Sourceยง

fn base_point(&self) -> L

Sourceยง

fn check_base_point_is_origin(&self) -> bool
where V: Form,

Sourceยง

fn check_preservation_of_origin(&self) -> bool
where V: Form,

Sourceยง

fn check_chart_at_base_point(&self) -> bool
where V: Form,

If a chart centred at p exists, chart_at(p) returns it. Formally: chart_at(p).base_point() == p whenever p is the base point of some valid chart in this atlas. Read more
Sourceยง

impl<T> From<T> for T

Sourceยง

fn from(t: T) -> T

Returns the argument unchanged.

Sourceยง

impl<T, U> Into<U> for T
where U: From<T>,

Sourceยง

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Sourceยง

impl<M> Monoid for M
where M: Point + One,

Sourceยง

fn check_left_identity(&self) -> bool
where Self: PartialEq,

Sourceยง

fn check_right_identity(&self) -> bool
where Self: PartialEq,

Sourceยง

fn check_associativity(a: Self, b: Self, c: Self) -> bool
where Self: PartialEq,

Sourceยง

impl<G> MulGroup for G
where G: Monoid + Inv<Output = G>,

Sourceยง

impl<T> OptionallyOption<T> for T

Sourceยง

fn into_option(self) -> Option<T>

Converts either permitted representation into Option<T>. Read more
Sourceยง

impl<T> Point for T
where T: Clone + Debug,

Sourceยง

impl<V, E> PseudoRiemannian<V> for E
where V: Bilinear, <V as Tensor>::F: Real, E: ExpMap<E, V> + Interval<R = <V as Tensor>::F>,

Sourceยง

fn check_isometry(&self, v: V) -> bool

Sourceยง

impl<T> Reassociate for T

Sourceยง

fn reassociate<P>( self, ) -> <<Self as ReassociateKernel<P>>::Reassociated as NormalizeWith<Undecorated>>::Normalized
where Self: ReassociateKernel<P>, <Self as ReassociateKernel<P>>::Reassociated: NormalizeWith<Undecorated>,

Sourceยง

impl<V, L> Smooth<V> for L
where V: Tensor, L: LieGroup<V>,

Sourceยง

type Global = L

The result of applying the exponential map. Read more
Sourceยง

fn exp(&self, coord: V) -> L

The exponential map at self: sends a tangent vector v to the point reached by following the geodesic from self in direction v for unit time.
Sourceยง

fn log(&self, point: &L) -> Option<V>

The logarithmic map at self: recovers the tangent vector whose geodesic reaches other, or None at the cut locus (e.g. the antipode on a sphere).
Sourceยง

impl<V, L> TangentBundle<L, V> for L
where V: Tensor, L: Smooth<V>,

Sourceยง

impl<T> ToOwned for T
where T: Clone,

Sourceยง

type Owned = T

The resulting type after obtaining ownership.
Sourceยง

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Sourceยง

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Sourceยง

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Sourceยง

type Error = Infallible

The type returned in the event of a conversion error.
Sourceยง

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Sourceยง

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Sourceยง

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Sourceยง

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.