pub trait RecipOrZero {
// Required method
fn recip_or_zero(self) -> Self;
}
Expand description
An extension trait for computing reciprocals without division by zero.
Required Methods§
Sourcefn recip_or_zero(self) -> Self
fn recip_or_zero(self) -> Self
Computes the reciprocal of self
if self
is not zero,
and returns zero otherwise to avoid division by zero.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.