pub enum RoundingStrategy {
MidpointAwayFromZero,
MidpointToEven,
Ceiling,
Floor,
Truncate,
}Expand description
Explicit rounding strategy. Always required — no hidden defaults.
Variants§
MidpointAwayFromZero
Rounds midpoint 0.5 away from zero (also known as commercial or half-up rounding). The most common choice for invoicing.
MidpointToEven
Rounds midpoint 0.5 to the nearest even digit (banker’s rounding). Minimises cumulative rounding bias over many operations.
Ceiling
Always round toward positive infinity.
Floor
Always round toward negative infinity.
Truncate
Truncate toward zero (discard fractional digits).
Trait Implementations§
Source§impl Clone for RoundingStrategy
impl Clone for RoundingStrategy
Source§fn clone(&self) -> RoundingStrategy
fn clone(&self) -> RoundingStrategy
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for RoundingStrategy
Source§impl Debug for RoundingStrategy
impl Debug for RoundingStrategy
Source§impl<'de> Deserialize<'de> for RoundingStrategy
impl<'de> Deserialize<'de> for RoundingStrategy
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<RoundingStrategy, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<RoundingStrategy, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for RoundingStrategy
Source§impl Hash for RoundingStrategy
impl Hash for RoundingStrategy
Source§impl PartialEq for RoundingStrategy
impl PartialEq for RoundingStrategy
Source§impl Serialize for RoundingStrategy
impl Serialize for RoundingStrategy
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl StructuralPartialEq for RoundingStrategy
Auto Trait Implementations§
impl Freeze for RoundingStrategy
impl RefUnwindSafe for RoundingStrategy
impl Send for RoundingStrategy
impl Sync for RoundingStrategy
impl Unpin for RoundingStrategy
impl UnsafeUnpin for RoundingStrategy
impl UnwindSafe for RoundingStrategy
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more