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: CentsSigned
pub const fn new(value: i64) -> CentsSigned
pub const fn inner(self) -> i64
pub fn is_negative(self) -> bool
pub fn checked_sub(self, rhs: CentsSigned) -> Option<CentsSigned>
pub fn checked_add(self, rhs: CentsSigned) -> Option<CentsSigned>
pub fn to_dollars(self) -> Dollars
pub fn round_to(self, digits: i32) -> CentsSigned
Trait Implementations§
Source§impl Add for CentsSigned
impl Add for CentsSigned
Source§type Output = CentsSigned
type Output = CentsSigned
The resulting type after applying the
+ operator.Source§fn add(self, rhs: CentsSigned) -> <CentsSigned as Add>::Output
fn add(self, rhs: CentsSigned) -> <CentsSigned as Add>::Output
Performs the
+ operation. Read moreSource§impl AddAssign for CentsSigned
impl AddAssign for CentsSigned
Source§fn add_assign(&mut self, rhs: CentsSigned)
fn add_assign(&mut self, rhs: CentsSigned)
Performs the
+= operation. Read moreSource§impl Bytes for CentsSigned
impl Bytes for CentsSigned
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<CentsSigned, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<CentsSigned, <__D as Deserializer<'de>>::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§type Output = CentsSigned
type Output = CentsSigned
The resulting type after applying the
/ operator.Source§fn div(self, rhs: CentsSigned) -> <CentsSigned as Div>::Output
fn div(self, rhs: CentsSigned) -> <CentsSigned as Div>::Output
Performs the
/ operation. Read moreSource§impl Formattable for CentsSigned
impl Formattable for CentsSigned
Source§impl From<CentsSigned> for Dollars
impl From<CentsSigned> for Dollars
Source§fn from(value: CentsSigned) -> Dollars
fn from(value: CentsSigned) -> Dollars
Converts to this type from the input type.
Source§impl From<CentsSigned> for f64
impl From<CentsSigned> for f64
Source§fn from(value: CentsSigned) -> f64
fn from(value: CentsSigned) -> f64
Converts to this type from the input type.
Source§impl From<CentsSigned> for i64
impl From<CentsSigned> for i64
Source§fn from(value: CentsSigned) -> i64
fn from(value: CentsSigned) -> i64
Converts to this type from the input type.
Source§impl From<CentsSigned> for u64
impl From<CentsSigned> for u64
Source§fn from(value: CentsSigned) -> u64
fn from(value: CentsSigned) -> u64
Converts to this type from the input type.
Source§impl From<CentsSigned> for usize
impl From<CentsSigned> for usize
Source§fn from(value: CentsSigned) -> usize
fn from(value: CentsSigned) -> usize
Converts to this type from the input type.
Source§impl From<Dollars> for CentsSigned
impl From<Dollars> for CentsSigned
Source§fn from(value: Dollars) -> CentsSigned
fn from(value: Dollars) -> CentsSigned
Converts to this type from the input type.
Source§impl From<i128> for CentsSigned
impl From<i128> for CentsSigned
Source§fn from(value: i128) -> CentsSigned
fn from(value: i128) -> CentsSigned
Converts to this type from the input type.
Source§impl From<i64> for CentsSigned
impl From<i64> for CentsSigned
Source§fn from(value: i64) -> CentsSigned
fn from(value: i64) -> CentsSigned
Converts to this type from the input type.
Source§impl From<u128> for CentsSigned
impl From<u128> for CentsSigned
Source§fn from(value: u128) -> CentsSigned
fn from(value: u128) -> CentsSigned
Converts to this type from the input type.
Source§impl From<u64> for CentsSigned
impl From<u64> for CentsSigned
Source§fn from(value: u64) -> CentsSigned
fn from(value: u64) -> CentsSigned
Converts to this type from the input type.
Source§impl From<usize> for CentsSigned
impl From<usize> for CentsSigned
Source§fn from(value: usize) -> CentsSigned
fn from(value: usize) -> CentsSigned
Converts to this type from the input type.
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§fn mul(self, rhs: CentsSigned) -> <CentsSigned as Mul>::Output
fn mul(self, rhs: CentsSigned) -> <CentsSigned as Mul>::Output
Performs the
* operation. Read moreSource§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§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
Source§impl Sub for CentsSigned
impl Sub for CentsSigned
Source§type Output = CentsSigned
type Output = CentsSigned
The resulting type after applying the
- operator.Source§fn sub(self, rhs: CentsSigned) -> <CentsSigned as Sub>::Output
fn sub(self, rhs: CentsSigned) -> <CentsSigned as Sub>::Output
Performs the
- operation. Read moreSource§impl SubAssign for CentsSigned
impl SubAssign for CentsSigned
Source§fn sub_assign(&mut self, rhs: CentsSigned)
fn sub_assign(&mut self, rhs: CentsSigned)
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 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