pub struct PositiveDecimal(/* private fields */);Expand description
Direct access to decimal types.
Decimal constrained to x > 0.
Implementations§
Source§impl PositiveDecimal
impl PositiveDecimal
Sourcepub fn new(value: BigDecimal) -> Result<PositiveDecimal, DecimalConstraintError>
pub fn new(value: BigDecimal) -> Result<PositiveDecimal, DecimalConstraintError>
Sourcepub const fn as_decimal(&self) -> &BigDecimal
pub const fn as_decimal(&self) -> &BigDecimal
Returns the wrapped decimal by reference.
Sourcepub fn into_inner(self) -> BigDecimal
pub fn into_inner(self) -> BigDecimal
Returns the wrapped decimal.
Trait Implementations§
Source§impl AsRef<BigDecimal> for PositiveDecimal
impl AsRef<BigDecimal> for PositiveDecimal
Source§fn as_ref(&self) -> &BigDecimal
fn as_ref(&self) -> &BigDecimal
Converts this type into a shared reference of the (usually inferred) input type.
Source§impl Clone for PositiveDecimal
impl Clone for PositiveDecimal
Source§fn clone(&self) -> PositiveDecimal
fn clone(&self) -> PositiveDecimal
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 moreSource§impl Debug for PositiveDecimal
impl Debug for PositiveDecimal
Source§impl Decimal128Mantissa for PositiveDecimal
impl Decimal128Mantissa for PositiveDecimal
Source§impl<'de> Deserialize<'de> for PositiveDecimal
impl<'de> Deserialize<'de> for PositiveDecimal
Source§fn deserialize<D>(
deserializer: D,
) -> Result<PositiveDecimal, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<PositiveDecimal, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for PositiveDecimal
impl Display for PositiveDecimal
impl Eq for PositiveDecimal
Source§impl From<PositiveDecimal> for BigDecimal
impl From<PositiveDecimal> for BigDecimal
Source§fn from(value: PositiveDecimal) -> BigDecimal
fn from(value: PositiveDecimal) -> BigDecimal
Converts to this type from the input type.
Source§impl From<PositiveDecimal> for NonNegativeDecimal
impl From<PositiveDecimal> for NonNegativeDecimal
Source§fn from(value: PositiveDecimal) -> NonNegativeDecimal
fn from(value: PositiveDecimal) -> NonNegativeDecimal
Converts to this type from the input type.
Source§impl PartialEq for PositiveDecimal
impl PartialEq for PositiveDecimal
Source§fn eq(&self, other: &PositiveDecimal) -> bool
fn eq(&self, other: &PositiveDecimal) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl PartialOrd for PositiveDecimal
impl PartialOrd for PositiveDecimal
Source§impl Serialize for PositiveDecimal
impl Serialize for PositiveDecimal
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 PositiveDecimal
Source§impl TryFrom<BigDecimal> for PositiveDecimal
impl TryFrom<BigDecimal> for PositiveDecimal
Source§type Error = DecimalConstraintError
type Error = DecimalConstraintError
The type returned in the event of a conversion error.
Source§fn try_from(
value: BigDecimal,
) -> Result<PositiveDecimal, <PositiveDecimal as TryFrom<BigDecimal>>::Error>
fn try_from( value: BigDecimal, ) -> Result<PositiveDecimal, <PositiveDecimal as TryFrom<BigDecimal>>::Error>
Performs the conversion.
Auto Trait Implementations§
impl Freeze for PositiveDecimal
impl RefUnwindSafe for PositiveDecimal
impl Send for PositiveDecimal
impl Sync for PositiveDecimal
impl Unpin for PositiveDecimal
impl UnsafeUnpin for PositiveDecimal
impl UnwindSafe for PositiveDecimal
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Decimal128Encode for Twhere
T: Decimal128Mantissa,
impl<T> Decimal128Encode for Twhere
T: Decimal128Mantissa,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Key for Twhere
T: Clone,
impl<T> Key for Twhere
T: Clone,
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
Fallible version of
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
Converts the given value to a
CompactString. Read more