Trait fixed::traits::FixedOptionalFeatures
source · pub trait FixedOptionalFeatures: Sealedwhere
Self: Zero + Bounded + Inv + CheckedAdd + CheckedSub + CheckedNeg + CheckedMul + CheckedDiv + CheckedRem + CheckedShl + CheckedShr + SaturatingAdd + SaturatingSub + SaturatingMul + WrappingAdd + WrappingSub + WrappingNeg + WrappingMul + WrappingShl + WrappingShr + OverflowingAdd + OverflowingSub + OverflowingMul + ToPrimitive + FromPrimitive + FloatConst,{ }
Expand description
This trait is used to provide supertraits to the Fixed
trait
depending on the crate’s optional features, and should not be used directly.
-
If the
arbitrary
feature is enabled, [Arbitrary
] is a supertrait ofFixed
. -
If the
borsh
experimental feature is enabled, [BorshSerialize
] and [BorshDeserialize
] are supertraits ofFixed
. -
If the
num-traits
experimental feature is enabled, the following are supertraits ofFixed
:Zero
Bounded
Inv
CheckedAdd
,CheckedSub
,CheckedNeg
,CheckedMul
,CheckedDiv
,CheckedRem
,CheckedShl
,CheckedShr
SaturatingAdd
,SaturatingSub
,SaturatingMul
WrappingAdd
,WrappingSub
,WrappingNeg
,WrappingMul
,WrappingShl
,WrappingShr
OverflowingAdd
,OverflowingSub
,OverflowingMul
ToPrimitive
,FromPrimitive
FloatConst
The following are not supertraits of
Fixed
, even though they are implemented for fixed-point numbers where applicable:One
because not all fixed-point numbers can represent the value 1Num
because it hasOne
as a supertraitMulAdd
,MulAddAssign
becauseMulAdd::mul_add
conflicts withFixed::mul_add
Similarly,
Signed
andUnsigned
are not supertraits ofFixedSigned
andFixedUnsigned
because they haveNum
as a supertrait. -
If the
serde
feature is enabled, [Serialize
] and [Deserialize
] are supertraits ofFixed
.