pub trait Convertible: Clone {
// Required methods
fn add_refs(&self, other: &Self) -> Self;
fn mul_refs(&self, other: &Self) -> Self;
fn from_ratio_bigint(ratio: Ratio<BigInt>) -> Option<Self>;
fn reciprocal(&self) -> Self;
}
Expand description
A trait for types that can be converted between two units.
Required Methods§
Sourcefn mul_refs(&self, other: &Self) -> Self
fn mul_refs(&self, other: &Self) -> Self
Multiplies two values by reference, avoiding data cloning.
Sourcefn from_ratio_bigint(ratio: Ratio<BigInt>) -> Option<Self>
fn from_ratio_bigint(ratio: Ratio<BigInt>) -> Option<Self>
Converts a Ratio<BigInt>
to the implementing type.
Sourcefn reciprocal(&self) -> Self
fn reciprocal(&self) -> Self
Returns the reciprocal of the implementing type.
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.