pub struct CentsSigned(/* private fields */);Expand description
Signed cents (i64) - for values that can be negative. Used for profit/loss calculations, deltas, etc.
Implementations§
Source§impl CentsSigned
impl CentsSigned
pub const ZERO: Self
pub const fn new(value: i64) -> Self
pub const fn inner(self) -> i64
pub fn is_negative(self) -> bool
pub fn checked_sub(self, rhs: Self) -> Option<Self>
pub fn checked_add(self, rhs: Self) -> Option<Self>
pub fn to_dollars(self) -> Dollars
pub fn round_to(self, digits: i32) -> Self
Trait Implementations§
Source§impl Add for CentsSigned
impl Add for CentsSigned
Source§impl AddAssign for CentsSigned
impl AddAssign for CentsSigned
Source§fn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
Performs the
+= operation. Read moreSource§impl Bytes for CentsSigned
impl Bytes for CentsSigned
Source§type Array = <i64 as Bytes>::Array
type Array = <i64 as Bytes>::Array
The byte array type returned by
to_bytes.
For fixed-size types, this is [u8; N] where N is the size of the type.Source§const IS_NATIVE_LAYOUT: bool = false
const IS_NATIVE_LAYOUT: bool = false
Whether the byte representation from
to_bytes is identical to the
in-memory representation of Self. When true, bulk operations can use
memcpy instead of per-element deserialization. Read moreSource§impl CheckedSub for CentsSigned
impl CheckedSub for CentsSigned
fn checked_sub(self, rhs: Self) -> Option<Self>
Source§impl Clone for CentsSigned
impl Clone for CentsSigned
Source§fn clone(&self) -> CentsSigned
fn clone(&self) -> CentsSigned
Returns a duplicate of the value. Read more
1.0.0 · 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 CentsSigned
impl Debug for CentsSigned
Source§impl Default for CentsSigned
impl Default for CentsSigned
Source§fn default() -> CentsSigned
fn default() -> CentsSigned
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for CentsSigned
impl<'de> Deserialize<'de> for CentsSigned
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for CentsSigned
impl Display for CentsSigned
Source§impl Div<usize> for CentsSigned
impl Div<usize> for CentsSigned
Source§impl Div for CentsSigned
impl Div for CentsSigned
Source§impl Formattable for CentsSigned
impl Formattable for CentsSigned
Source§impl From<CentsSigned> for Dollars
impl From<CentsSigned> for Dollars
Source§fn from(value: CentsSigned) -> Self
fn from(value: CentsSigned) -> Self
Converts to this type from the input type.
Source§impl From<CentsSigned> for f64
impl From<CentsSigned> for f64
Source§fn from(value: CentsSigned) -> Self
fn from(value: CentsSigned) -> Self
Converts to this type from the input type.
Source§impl From<CentsSigned> for i128
impl From<CentsSigned> for i128
Source§fn from(value: CentsSigned) -> Self
fn from(value: CentsSigned) -> Self
Converts to this type from the input type.
Source§impl From<CentsSigned> for i64
impl From<CentsSigned> for i64
Source§fn from(value: CentsSigned) -> Self
fn from(value: CentsSigned) -> Self
Converts to this type from the input type.
Source§impl From<CentsSigned> for u128
impl From<CentsSigned> for u128
Source§fn from(value: CentsSigned) -> Self
fn from(value: CentsSigned) -> Self
Converts to this type from the input type.
Source§impl From<CentsSigned> for u64
impl From<CentsSigned> for u64
Source§fn from(value: CentsSigned) -> Self
fn from(value: CentsSigned) -> Self
Converts to this type from the input type.
Source§impl From<CentsSigned> for usize
impl From<CentsSigned> for usize
Source§fn from(value: CentsSigned) -> Self
fn from(value: CentsSigned) -> Self
Converts to this type from the input type.
Source§impl From<Dollars> for CentsSigned
impl From<Dollars> for CentsSigned
Source§impl From<f64> for CentsSigned
impl From<f64> for CentsSigned
Source§impl From<i128> for CentsSigned
impl From<i128> for CentsSigned
Source§impl From<i64> for CentsSigned
impl From<i64> for CentsSigned
Source§impl From<u128> for CentsSigned
impl From<u128> for CentsSigned
Source§impl From<u64> for CentsSigned
impl From<u64> for CentsSigned
Source§impl From<usize> for CentsSigned
impl From<usize> for CentsSigned
Source§impl JsonSchema for CentsSigned
impl JsonSchema for CentsSigned
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Returns a string that uniquely identifies the schema produced by this type. Read more
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
Whether JSON Schemas generated for this type should be included directly in parent schemas,
rather than being re-used where possible using the
$ref keyword. Read moreSource§impl Mul<i64> for CentsSigned
impl Mul<i64> for CentsSigned
Source§impl Mul<usize> for CentsSigned
impl Mul<usize> for CentsSigned
Source§impl Mul for CentsSigned
impl Mul for CentsSigned
Source§type Output = CentsSigned
type Output = CentsSigned
The resulting type after applying the
* operator.Source§impl Ord for CentsSigned
impl Ord for CentsSigned
Source§fn cmp(&self, other: &CentsSigned) -> Ordering
fn cmp(&self, other: &CentsSigned) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for CentsSigned
impl PartialEq for CentsSigned
Source§impl PartialOrd for CentsSigned
impl PartialOrd for CentsSigned
Source§impl Pco for CentsSigned
impl Pco for CentsSigned
type NumberType = <i64 as Pco>::NumberType
Source§impl Serialize for CentsSigned
impl Serialize for CentsSigned
Source§impl Sub for CentsSigned
impl Sub for CentsSigned
Source§impl SubAssign for CentsSigned
impl SubAssign for CentsSigned
Source§fn sub_assign(&mut self, rhs: Self)
fn sub_assign(&mut self, rhs: Self)
Performs the
-= operation. Read moreimpl Copy for CentsSigned
impl Eq for CentsSigned
impl StructuralPartialEq for CentsSigned
impl TransparentPco<<i64 as Pco>::NumberType> for CentsSigned
Auto Trait Implementations§
impl Freeze for CentsSigned
impl RefUnwindSafe for CentsSigned
impl Send for CentsSigned
impl Sync for CentsSigned
impl Unpin for CentsSigned
impl UnsafeUnpin for CentsSigned
impl UnwindSafe for CentsSigned
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<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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<T> FromInnerSlice<<T as Pco>::NumberType> for Twhere
T: PcoVecValue,
impl<T> FromInnerSlice<<T as Pco>::NumberType> for Twhere
T: PcoVecValue,
const _SIZE_CHECK: ()
const _ALIGN_CHECK: ()
fn from_inner_slice(vec: Vec<<T as Pco>::NumberType>) -> Vec<T>
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 more